I use corepack with pnpm, which allows me not to worry about installing / updating versions, and using engines for that:
“engines”: {
“node”: “20.5”,
“pnpm”: “8.6.10”
},
But corepack doesn’t seem to work, as I simply get an error that pnpm version is mismatched…
I’ve actually managed to find a better way to do it, as I have tried both a script and using nom to install pnpm. The issue was that static sites have automatic installation of dependencies, so I couldn’t even get to the build command without a failure due to the engine settings.
So I first had to set SKIP_INSTALL_DEPS to true to disable automatic installation. After that what I originally wanted to do - use corepack, worked without issue. I just had to then set this in the build command: corepack enable; pnpm install; pnpm build;
My suggestion is to make it more obvious int he documentation about the automatic installation of dependencies, as it took me quite a bit of time before I stumbled on that option