Closed vincenzo closed 6 years ago
I'm expecting something is wrong in your lockfile. I can't reproduce this based on the issue description, so I'm going to close the issue.
Been there, done that (regenerating the lock file), didn't help. Like others in #2339, I can only work around this by adding webpack to my own app's dependencies, and I should not have to.
+1 Having same issue. Running yarn install --prod
instead of yarn install
(after removing node_modules
) gives me the following error when running next build
yarn run v1.9.4
$ next build
module.js:549
throw err;
^
Error: Cannot find module 'webpack/lib/RequestShortener'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/mypath/node_modules/friendly-errors-webpack-plugin/src/core/extractWebpackError.js:4:26)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/mypath/node_modules/friendly-errors-webpack-plugin/src/core/transformErrors.js:3:22)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If it helps, I'll add my app's deps:
"dependencies": {
"apollo-client-preset": "^1.0.8",
"classnames": "^2.2.5",
"clean-css": "^4.1.11",
"deepmerge": "^2.0.1",
"express": "^4.16.2",
"graphql": "^0.13.1",
"graphql-tag": "^2.7.3",
"isomorphic-unfetch": "2.0.0",
"lottie-web": "^5.1.9",
"next": "^5.1.0",
"platformsh": "^0.0.1",
"prop-types": "^15.6.0",
"react": "^16.2.0",
"react-apollo": "2.0.4",
"react-dom": "^16.2.0",
"react-jss": "^8.3.3",
"react-lazyload": "^2.3.0",
"react-no-ssr": "^1.1.0",
"react-slick": "^0.16.0",
"react-test-renderer": "^16.3.2",
"tinycolor2": "^1.4.1",
"webpack": "3.10.0"
},
(of course, webpack
is the workaround)
My lock file was generated fresh from these deps.
+1 I am also having this issue @timneutkens
Bug report
Related to #2339 but more specific.
The error:
Describe the bug
This error only happens when one runs
next build
after the app has been installed ([npm|yarn] install
) in an environment that hasNODE_ENV
set toproduction
.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
NODE_ENV=production
npm|yarn install
next build
Expected behavior
No error, build completes successfully.
System information
Additional context
Not sure whether the bug could be with Next or
friendly-errors-webpack-plugin
.Workaround
I am working around this bug by simply adding
webpack
to my app's dependencies (not devDeps). But I shouldn't have to.