react-boilerplate: Module not found: Error: Can't resolve 'fs'
Module not found: Error: Can’t resolve ‘fs’ in ‘/Users/js/code/react/react-boilerplate/node_modules/shelljs/src’
Issue Type
- Bug (https://github.com/mxstbr/react-boilerplate/blob/master/.github/CONTRIBUTING.md#bug-reports)
- Feature (https://github.com/mxstbr/react-boilerplate/blob/master/.github/CONTRIBUTING.md#feature-requests)
Description
I’ve used this boilerplate successfully in the past. First I tried it with yarn installed. Then, I uninstalled yarn and tried again. Same error both times.
Building the Webpack DLL...
Hash: f64cd94e521a0c2f99ea
Version: webpack 2.1.0-beta.25
Time: 4360ms
Asset Size Chunks Chunk Names
reactBoilerplateDeps.dll.js 3.32 MB 0 [emitted] reactBoilerplateDeps
chunk {0} reactBoilerplateDeps.dll.js (reactBoilerplateDeps) 2.79 MB [entry] [rendered]
[2] dll reactBoilerplateDeps 12 bytes {0} [built]
+ 736 hidden modules
ERROR in ./~/shelljs/src/common.js
Module not found: Error: Can't resolve 'fs' in '/Users/js/code/react/react-boilerplate/node_modules/shelljs/src'
@ ./~/shelljs/src/common.js 6:9-22
@ ./~/shelljs/shell.js
@ dll reactBoilerplateDeps
ERROR in ./~/shelljs/src/cd.js
Module not found: Error: Can't resolve 'fs' in '/Users/js/code/react/react-boilerplate/node_modules/shelljs/src'
@ ./~/shelljs/src/cd.js 1:9-22
@ ./~/shelljs/shell.js
@ dll reactBoilerplateDeps
ERROR in ./~/shelljs/src/ls.js
Module not found: Error: Can't resolve 'fs' in '/Users/js/code/react/react-boilerplate/node_modules/shelljs/src'
@ ./~/shelljs/src/ls.js 2:9-22
@ ./~/shelljs/shell.js
@ dll reactBoilerplateDeps
(truncated)
Steps to reproduce
git clone --depth=1 https://github.com/mxstbr/react-boilerplate.git
npm run setup
Versions
- Node/NPM:
$ yarn --version
0.17.9
$ npm --version
3.10.9
$ node --version
v7.2.0
- Browser: NA
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 11
- Comments: 15 (2 by maintainers)
Commits related to this issue
- Try to solve workbox fs problem. Solution from here: https://github.com/react-boilerplate/react-boilerplate/issues/1278. Sort of works but creates graceful-fs exception during runtime. — committed to johnnyoshika/jellypic-dashboard-from-redux-starter-kit by johnnyoshika 7 years ago
- Try to solve workbox fs problem. Solution taken from here: https://github.com/react-boilerplate/react-boilerplate/issues/1278. Solved on problem and created another. This time with graceful-fs. We g... — committed to johnnyoshika/jellypic-dashboard-from-redux-starter-kit by johnnyoshika 7 years ago
- proposed fix adding based on https://github.com/react-boilerplate/react-boilerplate/issues/1278 — committed to XevoInc/webcamdisplay-react by deleted user 7 years ago
- Try to solve workbox fs problem. Solution taken from here: https://github.com/react-boilerplate/react-boilerplate/issues/1278. Solved on problem and created another. This time with graceful-fs. We g... — committed to johnnyoshika/jellypic-dashboard-from-redux-starter-kit by johnnyoshika 7 years ago
- Try to solve workbox fs problem. Solution taken from here: https://github.com/react-boilerplate/react-boilerplate/issues/1278. Solved on problem and created another. This time with graceful-fs. We g... — committed to johnnyoshika/jellypic-dashboard-from-redux-starter-kit by johnnyoshika 7 years ago
- Try to solve workbox fs problem. Solution taken from here: https://github.com/react-boilerplate/react-boilerplate/issues/1278. Solved on problem and created another. This time with graceful-fs. We g... — committed to johnnyoshika/jellypic-dashboard-from-redux-starter-kit by johnnyoshika 7 years ago
I just had the same problem from a fresh clone of the repo.
I had to add this to the “webpack.base.babel.js” config:
I found the workaround here: https://github.com/webpack-contrib/css-loader/issues/447
I found the error for myself at least, the docs didn’t state all that well. You just need to add the conflicting package to
dllPlugin.exclude: []in yourpackage.jsonfile.One of the things that can cause this bug is adding packages to the wrong dependency section. For instance
yarn add gulpwill add it todependenciesinstead ofdevDependencies.I ended up trying @sebelga 's solution, but it still didn’t work – I found another suggestion on a different GH issue and this is what ended up working for me.
In your
webpack.config.*.jsfile, add the following topluginsafternew webpack.DllPlugin({}):new webpack.IgnorePlugin(/your_package_name_here/). For me, it was yarn that was blowing stuff up.Hope this helps!
Thanks @coleclayman! I had no luck with what seemed like an endless stream of other suggested fixes but your approach worked for me (in my case it was a host of packages but
|ing them all in the RE inIgnorePluginwas the fix:new webpack.IgnorePlugin(/fs|tls|net|child_process|term.js|pty.js|readline|dgram|dns|repl|\.\.\/API\/schema/)Hi, I am using react-boilerplate v3.3.3 with Node v6.9.2 with npm v3.10.9.
I added a new dependency (Raven v1.1.1) and when I run npm run build:dll facing the same Error.
Here is the stack error:
` Building the Webpack DLL… Hash: da2f8f7db2b0a2adbac2 Version: webpack 2.1.0-beta.25 Time: 7106ms Asset Size Chunks Chunk Names reactBoilerplateDeps.dll.js 4.04 MB 0 [emitted] reactBoilerplateDeps chunk {0} reactBoilerplateDeps.dll.js (reactBoilerplateDeps) 3.48 MB [entry] [rendered] [6] dll reactBoilerplateDeps 12 bytes {0} [built] + 875 hidden modules
ERROR in ./~/raven/lib/utils.js Module not found: Error: Can’t resolve ‘fs’ in ‘/Users//Documents/workspace//web_app/node_modules/raven/lib’ @ ./~/raven/lib/utils.js 3:9-22 @ ./~/raven/index.js @ dll reactBoilerplateDeps
ERROR in ./~/raven/lib/breadcrumbs.js Module not found: Error: Can’t resolve ‘pg’ in ‘/Users//Documents/workspace//web_app/node_modules/raven/lib’ @ ./~/raven/lib/breadcrumbs.js 132:13-26 @ ./~/raven/lib/client.js @ ./~/raven/index.js @ dll reactBoilerplateDeps
ERROR in ./~/lsmod/index.js Module not found: Error: Can’t resolve ‘fs’ in ‘/Users//Documents/workspace//web_app/node_modules/lsmod’ @ ./~/lsmod/index.js 2:9-22 @ ./~/raven/lib/utils.js @ ./~/raven/index.js @ dll reactBoilerplateDeps `