Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next.js build sometimes fails with "Cannot find module" error #27667

Open
lucacasonato opened this issue Jan 14, 2025 · 0 comments
Open

Next.js build sometimes fails with "Cannot find module" error #27667

lucacasonato opened this issue Jan 14, 2025 · 0 comments
Labels
nextjs Issue relating to Next.js

Comments

@lucacasonato
Copy link
Member

The error looks like this:

Error: Cannot find module './chunks/264.js'
Require stack:
- /tmp/build/src/.next/server/webpack-runtime.js
- /tmp/build/src/.next/server/pages/_document.js
- /tmp/build/src/node_modules/.deno/[email protected]/node_modules/next/dist/server/require.js
- /tmp/build/src/node_modules/.deno/[email protected]/node_modules/next/dist/server/load-components.js
- /tmp/build/src/node_modules/.deno/[email protected]/node_modules/next/dist/build/utils.js
- /tmp/build/src/node_modules/.deno/[email protected]/node_modules/next/dist/build/worker.js
- /tmp/build/src/node_modules/.deno/[email protected]/node_modules/next/dist/compiled/jest-worker/processChild.js
    at t.f.require (.next/server/webpack-runtime.js:1:1637)
    at <unknown> (.next/server/webpack-runtime.js:1:1110)
    at t.e (.next/server/webpack-runtime.js:1:1089) {
  code: "MODULE_NOT_FOUND",
  requireStack: [Array]
}

It usually gets fixed by cleaning node_modules/ and removing the DENO_DIR (path can be found in deno info).

I have absolutely no idea what causes this, nor how to reproduce it reliably.

@lucacasonato lucacasonato added bug Something isn't working correctly nextjs Issue relating to Next.js and removed bug Something isn't working correctly labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nextjs Issue relating to Next.js
Projects
None yet
Development

No branches or pull requests

1 participant