pnpm with Workers Builds
What's the best way to use pnpm with Workers Builds? Build output suggests it's detected but not installed.
7 Replies
maybe try to clear the build cache or delete/regenerate the lockfile? Looks like a version mismatch from the log above
It seems I need to make
.tools-versions
match the installed versions, or override the installed versions to match .tools-versions
. Too bad Workers Builds doesn't just pick up the versions in .tools-versions
when setting up the environment.@Kris it appears that you can set the desired pnpm version in the workers build config (like for cloudflare pages described here)

Note PNPM v8.x

Setting the PNPM_VERSION for the build, also appears to force the use of pnpm over npm, even if there is no lockfile (TIL 🎉)
And if you set the version to 9, it will pull the latest (v9.15.2) even if the build environment already has say v9.10 installed.
Thanks, yes, I've set
PNPM_VERSION
so an update doesn't break the build. I just wish it got the value from .tool-versions
so I don't need to remember to update the build config when we change the version.