{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/web3.js/issues/1969","repository_url":"https://api.github.com/repos/ethereum/web3.js","labels_url":"https://api.github.com/repos/ethereum/web3.js/issues/1969/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/web3.js/issues/1969/comments","events_url":"https://api.github.com/repos/ethereum/web3.js/issues/1969/events","html_url":"https://github.com/ethereum/web3.js/issues/1969","id":363266896,"node_id":"MDU6SXNzdWUzNjMyNjY4OTY=","number":1969,"title":"web3 does not work with webpack unless I manually install with --unsafe-perm=true","user":{"login":"evbots","id":3102036,"node_id":"MDQ6VXNlcjMxMDIwMzY=","avatar_url":"https://avatars3.githubusercontent.com/u/3102036?v=4","gravatar_id":"","url":"https://api.github.com/users/evbots","html_url":"https://github.com/evbots","followers_url":"https://api.github.com/users/evbots/followers","following_url":"https://api.github.com/users/evbots/following{/other_user}","gists_url":"https://api.github.com/users/evbots/gists{/gist_id}","starred_url":"https://api.github.com/users/evbots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evbots/subscriptions","organizations_url":"https://api.github.com/users/evbots/orgs","repos_url":"https://api.github.com/users/evbots/repos","events_url":"https://api.github.com/users/evbots/events{/privacy}","received_events_url":"https://api.github.com/users/evbots/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2018-09-24T18:27:11Z","updated_at":"2018-10-20T14:35:50Z","closed_at":null,"author_association":"NONE","body":"Hi web3 team,\r\n\r\nI have tried installing various versions of web3 in my webpack projects. I get very similar errors when using webpack to bundle client-side projects and server-side projects (specifically a serverless project using the serverless-webpack plugin).\r\n\r\nThe current version I'm using is web3@1.0.0-beta.35 in both my client and server-side projects.\r\n\r\n### Client-side project details:\r\n\r\nWith regards to my client-side react project, installing web3 as a dependency and webpacking results in the following error: `Module not found: Error: Can't resolve 'websocket' in '/home/circleci/project/node_modules/web3-providers-ws/src'`. This is what the package.json dependencies looks like for that project:\r\n\r\n```\r\n\"dependencies\": {\r\n    \"bootstrap\": \"^4.1.3\",\r\n    \"connected-react-router\": \"^4.4.1\",\r\n    \"husky\": \"^0.14.3\",\r\n    \"immutable\": \"^3.8.2\",\r\n    \"lint-staged\": \"^7.2.2\",\r\n    \"lodash\": \"^4.17.10\",\r\n    \"node-sass-chokidar\": \"^1.3.3\",\r\n    \"npm-run-all\": \"^4.1.3\",\r\n    \"prettier\": \"^1.14.2\",\r\n    \"react\": \"^16.4.1\",\r\n    \"react-dom\": \"^16.4.1\",\r\n    \"react-redux\": \"^5.0.7\",\r\n    \"react-router-dom\": \"^4.3.1\",\r\n    \"react-scripts\": \"1.1.4\",\r\n    \"redux\": \"^4.0.0\",\r\n    \"redux-immutable\": \"^4.0.0\",\r\n    \"web3\": \"1.0.0-beta.35\"\r\n  }\r\n```\r\n\r\nThis error magically goes away if I remove web3 from my `package.json` dependencies, and manually run: `npm install web3@1.0.0-beta.35 --save --save-exact --unsafe-perm=true` before webpacking my client-side bundle. This means I exclude web3 from my package.json dependencies, and run an extra step afterwards to install web3. I really don't like this, as it prevents me from generating a comprehensive package-lock.json.\r\n\r\nIt seems like one of the web3 dependencies needs more expansive file permissions in order to compile. Interestingly, this does not happen when I bundle via webpack locally on MacOS, only in my linux OS ci pipeline. I did some research trying to figure out if NPM would let me specify the `--unsafe-perm` flag in my package.json file, but it appears that flag is only respected when installing a single package.\r\n\r\nIs there any solution for this, or am I stuck with an extra step installing web3 manually with `--unsafe-perm`?"},"comment":{"url":"https://api.github.com/repos/ethereum/web3.js/issues/comments/431587171","html_url":"https://github.com/ethereum/web3.js/issues/1969#issuecomment-431587171","issue_url":"https://api.github.com/repos/ethereum/web3.js/issues/1969","id":431587171,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTU4NzE3MQ==","user":{"login":"evbots","id":3102036,"node_id":"MDQ6VXNlcjMxMDIwMzY=","avatar_url":"https://avatars3.githubusercontent.com/u/3102036?v=4","gravatar_id":"","url":"https://api.github.com/users/evbots","html_url":"https://github.com/evbots","followers_url":"https://api.github.com/users/evbots/followers","following_url":"https://api.github.com/users/evbots/following{/other_user}","gists_url":"https://api.github.com/users/evbots/gists{/gist_id}","starred_url":"https://api.github.com/users/evbots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evbots/subscriptions","organizations_url":"https://api.github.com/users/evbots/orgs","repos_url":"https://api.github.com/users/evbots/repos","events_url":"https://api.github.com/users/evbots/events{/privacy}","received_events_url":"https://api.github.com/users/evbots/received_events","type":"User","site_admin":false},"created_at":"2018-10-20T14:35:50Z","updated_at":"2018-10-20T14:35:50Z","author_association":"NONE","body":"Ok, I decided to go ahead and recreate the issue with my react-app right now. I added web3.js to package.json using `npm install web3@1.0.0-beta.35 --save --save-exact`, which results in `\"web3\": \"1.0.0-beta.35\"` added to dependencies. My build config file is the following:\r\n```\r\n# config.yml\r\n  build:\r\n    docker:\r\n      - image: circleci/node:8.11\r\n\r\n    working_directory: ~/code\r\n\r\n    steps:\r\n      - checkout\r\n\r\n      - run: |\r\n          sudo apt install python-dev python-pip\r\n          sudo pip install awscli\r\n\r\n      - run: npm install\r\n      - run: npm run build\r\n      - run: aws s3 sync build/ s3://my-test-bucket-web3/ --delete --exclude \"*.map\" --cache-control \"no-cache, no-store, must-revalidate\"\r\n```\r\nWeb3 is imported into App.js with the following line. `import Web3 from 'web3';`.\r\n\r\nMy build fails on the `npm run build` step with the following message:\r\n```\r\n#!/bin/bash -eo pipefail\r\nnpm run build\r\n\r\n> web3-test-website@0.1.0 build /home/circleci/code\r\n> npm-run-all build-css build-js\r\n\r\n\r\n> web3-test-website@0.1.0 build-css /home/circleci/code\r\n> node-sass-chokidar src/styles/manifest.scss src/styles/manifest.css\r\n\r\n\r\n> web3-test-website@0.1.0 build-js /home/circleci/code\r\n> react-scripts build\r\n\r\nCreating an optimized production build...\r\nFailed to compile.\r\n\r\nModule not found: Error: Can't resolve 'websocket' in '/home/circleci/code/node_modules/web3-providers-ws/src'\r\n```"}}
{"actor":{"display_login":"evbots"}}