I am having trouble using pnpm
with nextjs
on netlify. I followed the recommendations here Using pnpm and pnpm workspaces and https://github.com/netlify/build/issues/1633#issuecomment-712863250 which were initially working fine with next-on-netlify
. Now even that seems to be breaking.
With the next build plugin, I run into an error that says next
is not installed on the prebuild by the plugin, which runs before my custom prebuild which installs the packages.
Steps to reproduce the behaviour:
- Create a
next
project withpnpm
and the belownetlify.toml
- Push to netlify and build without cache. (I think it worked the first few times for me because it has next cached from
yarn
before, we just migrated over) - Should see the error in the console
This repo can be used to reproduce the bug GitHub - CryogenicPlanet/netlify-next-prebuild-bug
// netlify.toml
[build]
command = "npm run build"
publish = "out"
[build.environment]
NPM_FLAGS="--prefix=/dev/null"
[[plugins]]
package = "@netlify/plugin-nextjs"
Kind of blocked on this bug because netlify is not able to build our codebase and don’t want to move back to yarn
as it is occupying way too much space.
I posted this same bug on github too Prebuild error when using pnpm · Issue #219 · netlify/next-runtime · GitHub would love any recommendations to work around this