The error Cannot find module 'C:\Dropbox\NextRepro\next-error-reproduction\.next\build-manifest.json'
is printed to console, and browser is not being served any useful errors when masking an underlying issue from Webpack. This only happens for me in dev mode.
The underlying issue in my specific case is that ts-loader
does not exist, but I would expect the error from Webpack to be shown and not a not-so-useful error message about a build manifest not found 馃憤
Steps to reproduce the behavior, please provide code snippets or a repository:
npm run dev
http://localhost:3000
ts-loader
)Running npm run build
shows the real issue from Webpack, which is that ts-loader
does not exist. I'm aware that the dependency is not in package.json, which is intentional to show the error.
I would expect the correct error (Can't resolve 'ts-loader' in '<path>/next-error-reproduction'
) to be printed to both console and browser.
Might be similar in nature to https://github.com/zeit/next.js/issues/4598
Might be similar in nature to #4598
Just to confirm, this is unrelated and not the same issue.
Happened to me too!!! Just by importing a non existing module on _app.js or any other page.
For now, if you're getting this and want to know what the underlying cause is, try creating a fake build-manifest.json
with {}
in it. It revealed the actual error for me
I'm getting this too.
I see it happen after a restart my server and a package can't be found from my _error.js
page.
I can reliably reproduce by creating a syntax error in _error.js
and then restarting the server.
webpack: wait until bundle finished:
ERROR Failed to compile with 1 errors 20:02:18
This dependency was not found:
* @live/next-error in ./packages/xxx/apps/xxx/packages/app/pages/_error.js
To install it, you can run: npm install --save @live/next-error
...
# NOTE: I am hooking Module.resolveFilename for logging purposes.
{ Error: Cannot find module 'xxx/packages/xxx/apps/xxx/packages/app/build/local/dev/build-manifest.json'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._resolveFilename (xxx/packages/public/framework/server-init/index.js:270:41)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at _callee3$ (xxx/node_modules/.registry.npmjs.org/@vjpr/next/6.1.0-vjpr.1/node_modules/@vjpr/next/dist/server/render.js:203:29)
at tryCatch (xxx/node_modules/.registry.npmjs.org/regenerator-runtime/0.11.1/node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (xxx/node_modules/.registry.npmjs.org/regenerator-runtime/0.11.1/node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (xxx/node_modules/.registry.npmjs.org/regenerator-runtime/0.11.1/node_modules/regenerator-runtime/runtime.js:114:21)
at step (xxx/node_modules/.registry.npmjs.org/@babel/runtime/7.0.0-beta.49/node_modules/@babel/runtime/helpers/asyncToGenerator.js:12:30)
at _next (xxx/node_modules/.registry.npmjs.org/@babel/runtime/7.0.0-beta.49/node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:9)
at <anonymous> code: 'MODULE_NOT_FOUND' }
So looks like in BuildManifestPlugin
, emit
event is not fired on error, therefore no manifest built.
dev && new webpack.NoEmitOnErrorsPlugin(),
https://stackoverflow.com/questions/40080501/webpack-when-to-use-noerrorsplugin
NOTE: Name changes in webpack4 to optimization.noEmitOnErrors
.
@timneutkens What should the fix be?
should-emit
and generate empty build manifest?Maybe it is a special case because the _error
component is causing the errors and can't render the errors.
If I syntax error a normal page, it works fine - error shown correctly.
Bump @timneutkens
Please don't bump issues.
@timneutkens What should the fix be?
Just wanted to get your feedback on what the fix should be so I can open a PR :)
I guess if nothing breaks we can enable emit
Any update on this issue? Also experiencing it.
Issue for me also. Seems to happen when I change branches. After doing another reinstall it still carries on to annoy me.
This issue just happened to me and lead me here. Preferably a dummy build manifest would be generated to work around this symptomatic error of a broken import.
Happened to me after i rename layout.js to Layout.js. The command below may help.
git config core.ignorecase false
git status
Also had same issue.
I upgraded Next to 7.0.1 and saw webpack compilation errors on my code.
After fails were fixed "Error: Cannot find module '
Can confirm @mattisa's comments.
I encountered the error just after I had deleted .next/
, whilst having a legitimate build error printed in the console (though I had to scroll up to see them), once they were handled, I restarted my server and everything built fine.
Using [email protected]
Similarly to @tomspeak I was trying to test out upgrading to [email protected]
. Upon switching back is when I started running into problems which led me here. I had to delete .next/
and node_modules/
to get everything working properly again (on [email protected]
).
NODE_ENV=production next build
usually reveals the hidden error for me... 馃
@malixsys my error was as a simple as a
Most helpful comment
Happened to me too!!! Just by importing a non existing module on _app.js or any other page.