Next.js Discord

Discord Forum

Rebuild standalone output broke nextjs package (node_modules/next)

Unanswered
Cardigan Welsh Corgi posted this in #help-forum
Open in Discord
Cardigan Welsh CorgiOP
I encountered an issue when building my Next.js project with the standalone output.
On the first build, there was no module not found error. However, on the second build, I noticed that the Next.js files inside node_modules were missing, causing a module not found error.
I realized that this issue only occurs when I build the project using the standalone output.
I also found that this error occurs in the latest version of Next.js

Error: Cannot find module '...\cna\node_modules\.pnpm\next@15.1.6_react-dom@19.0.0_react@19.0.0__react@19.0.0\node_modules\next\dist\compiled\jest-worker\processChild.js'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
    at Function._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
    at node:internal/main/run_main_module:36:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}


node: 22.12.0
pnpm: 9.7.0

0 Replies