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? 🤔
#Help with `standalone` Next.js build on turborepo
11 messages · Page 1 of 1 (latest)
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-modulesconfigured andexperimental.outputFileTracingRootset to my root folder.
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
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.
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
Okay, I think I see where my problem is now. In the with-docker repo (https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile), there's no instruction of copying the node_modules to the runner:
In this discussion though, the node_modules part is copied: https://github.com/vercel/next.js/discussions/16995#discussioncomment-841952