Running a built nextjs application with node gives the './server.edge' is not defined error
Answered
American Crocodile posted this in #help-forum
American CrocodileOP
I'm helping someone deploy a next.js project using Node. for it to work I assume the build artifact should be able to run from node standalone.
The project is part of a NX monorepo so I grab the build artifact from there, run
I also get this error
Googling this most things I find are related to problems deploying on Vercel or Netlify and claims it is fixed with version 13.5.2
I'm using 13.5.3 and React-dom 18.2
I'm thinking that it is possible something is missing from the NX build artifact but I really need a bit of a clue of what that could be. What would cause this error?
The project is part of a NX monorepo so I grab the build artifact from there, run
npm install and npm run start and I get a page with Internal Server Error and I get the ./server.edge error in console.outputI also get this error
Error: Cannot find module 'next/dist/shared/lib/html-context.js'Googling this most things I find are related to problems deploying on Vercel or Netlify and claims it is fixed with version 13.5.2
I'm using 13.5.3 and React-dom 18.2
I'm thinking that it is possible something is missing from the NX build artifact but I really need a bit of a clue of what that could be. What would cause this error?
Answered by Polar bear
I was able to get around this by deleting
node_modules and the .next directory, npm run build && npm run start2 Replies
Polar bear
Also having this issue. Not on Netlify or Vercel either. Only seems to be affecting dynamic routes, static routes are working fine.
Polar bear
I was able to get around this by deleting
node_modules and the .next directory, npm run build && npm run startAnswer