next.js, pnpm and monorepo deployment

robbydoooBIZCLASS

6 months ago

I am trying to deploy a next.js application that is in a pnpm monorepo but it fails to deploy because of the configuration.

Because the lock file for pnpm is in the root of the monorepo I cant set the root directory to be that of the next.js application otherwise it tries to use npm instead of pnpm and so it
doesnt pick up the other shared packages.

Anyone know what the railway configuration should look like to support this?

0 Replies

robbydoooBIZCLASS

6 months ago

d5955a18-d51c-4ad1-9601-a5bea57f565c


6 months ago

isolated or shared monorepo?


robbydoooBIZCLASS

6 months ago

shared


robbydoooBIZCLASS

6 months ago

I got it working by using cd [PATH] && pnpm build and the same for start also but not sure if thats the best approach.


6 months ago

using cd in build or start commands is almost never the correct solution.

how are you managing the monorepo? workspaces, turbo, nx, etc?


next.js, pnpm and monorepo deployment - Railway Help Station