vercel: Regression: `vercel build` fails with pnpm v9.1.x on latest Vercel CLI
https://github.com/vercel/vercel/pull/11596 seems to have introduced a regression in https://github.com/vercel/vercel/releases/tag/vercel%4034.2.0 when building with pnpm v9.1.0
Preview build logs before (notice CLI v.34.1.10)
[14:55:14.413] Running build in Washington, D.C., USA (East) – iad1
[14:55:14.541] Cloning [redacted]
[14:55:15.238] Cloning completed: 696.768ms
[14:55:15.239] Running "[ $(git branch --show-current) == "main" ]"
[14:55:15.652] Found .vercelignore
[14:55:15.665] Removed 4 ignored files defined in .vercelignore
[14:55:27.118] Restored build cache
[14:55:27.242] Running "vercel build"
[14:55:28.196] Vercel CLI 34.1.10
[14:55:29.754] Detected `pnpm-lock.yaml` version 9 generated by pnpm 8
[14:55:29.803] Installing dependencies...
Preview build logs after (notice CLI v34.2.0)
[16:08:05.141] Running build in Washington, D.C., USA (East) – iad1
[16:08:05.270] Cloning [redacted]
[16:08:06.157] Cloning completed: 886.836ms
[16:08:06.157] Running "[ $(git branch --show-current) == "main" ]"
[16:08:06.707] Found .vercelignore
[16:08:06.718] Removed 4 ignored files defined in .vercelignore
[16:08:38.984] Restored build cache
[16:08:39.073] Running "vercel build"
[16:08:40.095] Vercel CLI 34.2.0
[16:08:40.668] Detected `pnpm-lock.yaml` version 9 generated by pnpm 9
[16:08:40.701] Installing dependencies...
[16:08:41.533] ERR_PNPM_BAD_PM_VERSION This project is configured to use v9.1.0 of pnpm. Your current pnpm is v9.0.4
[16:08:41.533]
[16:08:41.534] If you want to bypass this version check, you can set the "package-manager-strict" configuration to "false" or set the "COREPACK_ENABLE_STRICT" environment variable to "0"
[16:08:41.550] Error: Command "pnpm install" exited with 1
[16:08:42.394]
package.json has
"packageManager": "pnpm@9.1.0",
and pnpm-lock.json has
lockfileVersion: '9.0'
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 29
- Comments: 26 (6 by maintainers)
Commits related to this issue
- nextjs-app (#54) * feat: addPACK_HOME to environment variables list https://github.com/vercel/vercel/issues/11607#issuecomment-2407850165 Includes COREPACK_HOME in the list of environment variabl... — committed to vyductan/vyductan-react by vyductan 2 years ago
- Update package.json, change pnpm version ot 9.0.4 refer to github issue: https://github.com/vercel/vercel/issues/11607 (maybe failed again, if yes then need to try again.) — committed to tommyming/simple-ab-quiz-website by tommyming 2 years ago
There are two different errors here, but they look very similar. Please take note of the exact error message for mitigation options below.
Note that Vercel uses specific versions of major versions of
pnpmby default. These can change, but right now, we support these versions ofpnpm:pnpm@6.35.1pnpm@7.33.5pnpm@8.15.8pnpm@9.0.4The proper matching major version is used based on the lockfile version and the
package.json#packageManagerversion (if it exists).If you want the exact version specified in
package.json#packageManager, you need to enable corepack on Vercel.We’re working on improving this developer experience in general, as well.
pnpm error
ERR_PNPM_UNSUPPORTED_ENGINEFor anyone seeing the
ERR_PNPM_UNSUPPORTED_ENGINEerror frompnpm, you can work around this problem by doing any of the following:ENABLE_EXPERIMENTAL_COREPACKto1package.json#packageManagervaluepackage.json#engines.pnpmvalue (pnpm docs)cc @Jarrku
pnpm error
ERR_PNPM_BAD_PM_VERSIONFor anyone seeing the
ERR_PNPM_BAD_PM_VERSIONerror frompnpm, you can work around this problem by doing any of the following:ENABLE_EXPERIMENTAL_COREPACKto1COREPACK_ENABLE_STRICTto0pnpmchecks this valuepackage-manager-stricttofalsein.npmrccc @AurelienGasser
Also running into this issue, our builds started failing somewhere today, as it’s not detecting the pnpm override anymore it seems.
Logs from a build ~8h ago:
Logs I’m getting now:
pnpm error
ERR_PNPM_BAD_PM_VERSIONWe’ve rolled out a change that disables
pnpm@9’s strictness when checking thepackage.json#packageManagervalue. You can still enable this strictness in your project by settingpackage-manager-stricttotruein your.npmrc.You will still see pnpm’s warning when these versions don’t match, but it will not error and break the build on Vercel.
That issue should be resolved for everyone now. If you still encounter it, let me know in this thread.
Corepack enabled, but still getting
ERR_PNPM_UNSUPPORTED_ENGINEWe’re still digging into this. I’ve not been able to reproduce it a single time.
If you are still seeing this, let me know!
If you have a reproduction, let me know!
You can respond here and/or send a tarball of a project that reproduces the problem to sean.massa@vercel.com. Thanks!
It started this morning with no changes on our end. If @Jarrku doesn’t get more info for you I can try to look into it on Monday. We ended up pinning our version of pnpm to 9.0.4 to match vercel for now.
@Jarrku you should be able to have it working like that. I didn’t notice in your logs that corepack was already enabled. That’s a separate issue.
Corepack enabled, but still getting
ERR_PNPM_UNSUPPORTED_ENGINEIf you see both these items in your logs:
Detected ENABLE_EXPERIMENTAL_COREPACK=1 ...ERR_PNPM_UNSUPPORTED_ENGINEThen you have a special case of this error. We’re diagnosing this problem now. If you can share your project, a specific deployment, even source code, that’d be awesome. Feel free to email me a zip even, if that’s possible, at sean.massa@vercel.com.
We rolled out a fix that detects
packageManagerin the root package.json! It is no longer necessary to definepackageManagerin every package of a monorepo.Turborepo projects using corepack may see corepack getting disabled. To solve this, either:
turboto2.1.3or higher ORCOREPACK_HOMEtoturbo.json#globalPassThroughEnvI have the same problem with a monorepo. To solve it I had to set the engines and packageManager in every package because Vercel does not look at the engines and packageManager in the root package.json. Additionally I had to set this environment variable for all builds:
ENABLE_EXPERIMENTAL_COREPACK=1Looks like it’s not enough to set
ENABLE_EXPERIMENTAL_COREPACKto1.You need to remove pnpm from engines in package.json which is weird because you want it for errors in version mismatch for local development.And it doesn’t look like corepack works or how should I interpret this?
@nerdo, yes we are using turborepo as well. And my feeling was that it had to do with some tool. I was thinking next but turborepo would make sense as well.
Doesn’t seem to be solved yet, tried with the latest PNPM 9.1.3 and the issue persists.
@EndangeredMassa
On my phone currently, but here’s a deployment link https://vercel.com/pexip-engage/booking-plugin/FMxsmUohJXkv8rByEV3ZaE9PrjRY
Most of our projects under pexip engage are failing.
I can share the root package json if that’s helpful?
@EndangeredMassa
We have corepack enabled & have packageManager set to 9.1.1
If I understand correctly, we should not set the engines field, because this overrules the other settings?