question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module '/path/.next/build-manifest.json'

See original GitHub issue

Bug report

Describe the bug

When a SASS error happens, the Next CLI properly tells me about the SASS error, but then it prints this error to the console every few seconds until I fix the SASS error:

{ Error: Cannot find module '/Users/zach/dev/test/next-module-not-found-bug/.next/build-manifest.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.loadComponents (/Users/zach/dev/test/next-module-not-found-bug/node_modules/next/dist/next-server/server/load-components.js:29:9)
    at DevServer.findPageComponents (/Users/zach/dev/test/next-module-not-found-bug/node_modules/next/dist/next-server/server/next-server.js:529:60)
    at DevServer.renderErrorToHTML (/Users/zach/dev/test/next-module-not-found-bug/node_modules/next/dist/next-server/server/next-server.js:829:33)
    at DevServer.renderErrorToHTML (/Users/zach/dev/test/next-module-not-found-bug/node_modules/next/dist/server/next-dev-server.js:15:811)
    at process._tickCallback (internal/process/next_tick.js:68:7) code: 'MODULE_NOT_FOUND' }

To Reproduce

I’ve created a reproduction repository here.

Note: The SASS error in this repository is intentional to demonstrate this Next.js issue

  1. Run the following in a terminal:
git clone https://github.com/zposten/next-module-not-found-bug.git
cd next-module-not-found-bug
yarn
yarn start
  1. See error

Expected behavior

The SASS error should be printed a single time. This other error should not be printed to the terminal continuously.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: macOS 10.15.3
  • Version of Next.js: 9.3.2

Additional Context

Both of the apps that I’ve seen this issue in have

I have not exhaustively tested various configurations to figure out the precise cause of this issue.

This issue seems similar to:

…but all these issues are closed

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:29
  • Comments:29

github_iconTop GitHub Comments

27reactions
kriscarlecommented, Dec 29, 2020

I resolved this error by removing the .next folder and node_modules and reinstalling with yarn.

rm -rf .next
rm -rf node_modules
yarn
25reactions
aaron5670commented, Jun 29, 2021

I upgraded from 10.2.1 to 11.0.1 and went into this problem. Still found no fix 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Error: Cannot find module '<path>/build-manifest.json'' masks ...
I'm aware that the dependency is not in package. json, which is intentional to show the error.
Read more >
Nextjs: Cannot find module path build-manifest.json masks an ...
I have experienced this issue with Next.js many times. Error: Cannot find module 'dist/build-manifest.json' ... ... If you met this issue, just ...
Read more >
Error: Cannot find module <path> build-manifest.json masks ...
I have experienced this issue with Next.js many times. If you met this issue, just simply check if you have a wrong or...
Read more >
0 - Stack Overflow
NextJS - Error: Cannot find module '/<path>/.next/fallback-build-manifest.json' in next.config.js file · Ask Question. Asked 7 months ago.
Read more >
module-not-found - Next.js
Why This Error Occurred · The module you're trying to import is not installed in your dependencies · The module you're trying to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found