Standalone Build: Error when starting server
Unanswered
American black bear posted this in #help-forum
American black bearOP
Hi,
after building my Next-App, and then trying to start it, I get the following error:
This is the repo:
https://github.com/collective-change-org/website/tree/main/apps/payload
after building my Next-App, and then trying to start it, I get the following error:
node .next/standalone/server.js
node:internal/modules/cjs/loader:1144
const err = new Error(message);
^
Error: Cannot find module '../../lib/get-network-host'
Require stack:
- repo/apps/payload/node_modules/.pnpm/next@15.1.7_@babel+core@7.24.5_react-dom@19.0.0_react@19.0.0__react@19.0.0_sass@1.77.4/node_modules/next/dist/server/lib/start-server.js
- repo/apps/payload/.next/standalone/server.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at repo/node_modules/.pnpm/next@15.1.7_@babel+core@7.24.5_react-dom@19.0.0_react@19.0.0__react@19.0.0_sass@1.77.4/node_modules/next/dist/server/require-hook.js:55:36
at Module._load (node:internal/modules/cjs/loader:985:27)
…
code: 'MODULE_NOT_FOUND',
requireStack: [
'repo/apps/payload/node_modules/.pnpm/next@15.1.7_@babel+core@7.24.5_react-dom@19.0.0_react@19.0.0__react@19.0.0_sass@1.77.4/node_modules/next/dist/server/lib/start-server.js',
'repo/apps/payload/.next/standalone/server.js'
]
}
Node.js v20.11.0
This is the repo:
https://github.com/collective-change-org/website/tree/main/apps/payload
3 Replies
Mrigal carp
@American black bear Have you resolved it by any chanced?
I created an issue with the same problem
https://github.com/vercel/next.js/issues/77472
I created an issue with the same problem
https://github.com/vercel/next.js/issues/77472
American black bearOP
Yeah I have, everything is running smoothly for me now, not quite sure what I did though, I’ll have to take a look in my commit history
Mrigal carp
Well, there's a workaround to include the entire monorepo as tracing root
But that'd place my nextjs project deep into standalone like:
outputFileTracingRoot: path.resolve(process.cwd(), '../../'),
But that'd place my nextjs project deep into standalone like:
.next/standalone/projects/ui/server.js
instead of just .next/standalone/server.js