Next.js Discord

Discord Forum

Missing modules when next is standalone with pnpm in turborepo setup

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
I was wondering if anyone else has come across this issue.

I have migrated from yarn to pnpm in my turborepo setup.

I have an app that builds as standalone in NextJS. Previously it worked with yarn whereby it would bring all the dependencies across correctly in order for the server to startup from the standalone folder.

Since moving to pnpm this no longer works, it only brings a few dependencies over and leaves the rest in the pnpm-cache. This means core packages needed for next such as @swc/helpers and styled-jsx don’t get included in the .standalone node_modules, causing my app to not be able to startup.

I understand there are considerations with pnpm such as symlinking etc which can cause different behaviours with package resolution. But it just doesn’t seem right. I’ve seen that there is an open issue with people having a similar problem, but their solution is to install with yarn in a docker container when building the app for deploy. I don’t want to do that, there must be a better way to achieve this.

Here is the issue for reference: https://github.com/vercel/next.js/issues/48017

Has anyone come across this issue, and how did you overcome it?

0 Replies