next.js: 'Error: Cannot find module '/build-manifest.json'' masks an underlying issue
Bug report
Describe the bug
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 👍
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Go to https://github.com/eweilow/next-error-reproduction
- Clone the repo
- Install npm dependencies, run
npm run dev - Open
http://localhost:3000 - View console and browser (which show different errors in this case, but not anything about
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.
Expected behavior
I would expect the correct error (Can't resolve 'ts-loader' in '<path>/next-error-reproduction') to be printed to both console and browser.
System information
- OS: Windows
- Browser (if applies): N/A
- Version of Next.js: `6.0.2-canary.8
Additional context
Might be similar in nature to https://github.com/zeit/next.js/issues/4598
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 12
- Comments: 18 (5 by maintainers)
Please don’t bump issues.
Happened to me too!!! Just by importing a non existing module on _app.js or any other page.
NODE_ENV=production next buildusually reveals the hidden error for me… 🤔For now, if you’re getting this and want to know what the underlying cause is, try creating a fake
build-manifest.jsonwith{}in it. It revealed the actual error for meHappened to me after i rename layout.js to Layout.js. The command below may help.
Just to confirm, this is unrelated and not the same issue.
I guess if nothing breaks we can enable emit
Bump @timneutkens
I’m getting this too.
I see it happen after a restart my server and a package can’t be found from my
_error.jspage.I can reliably reproduce by creating a syntax error in
_error.jsand then restarting the server.