#Help with `standalone` Next.js build on turborepo

11 messages · Page 1 of 1 (latest)

rich valve
#

Hii there. I'm having some trouble with using the standalone output mode of next build. Right now, I'm trying to copy the .next/standalone folder and zip its contents alongside the static and public folders. Supposedly, running PORT=xxxx node apps/my-app/server.js would just run; when I try it it gives me a MODULE_NOT_FOUND error on styled-jsx. Any hints as to why this is happening? 🤔

#

Notes:

  • I'm on Next v12.1.6, not an option (yet) to switch to v12.2.x at the moment.
  • I have next-transpile-modules configured and experimental.outputFileTracingRoot set to my root folder.
compact plank
#

don't you still need to install npm deps? I am not 100% sure what standalone is about

#

ok from the doc you don't need an install but having the right packages copied

#

what does your node_modules look like here?

#

since it seems to be your issue

rich valve
#

Thanks @compact plank, I was under the impression that standalone mode would also include all deps when built, including node_modules. Checking now, there's no node_modules generated. I'll see how I can add these deps off of the original package.json.

compact plank
#

Yeah I think it's supposed to kinda copy node_modules but with only relevant files or smth like that

#

haven't tested it yet

rich valve