Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: vercel build fails with pnpm v9.1.x on latest Vercel CLI #11607

Open
AurelienGasser opened this issue May 16, 2024 · 12 comments
Open

Comments

@AurelienGasser
Copy link

#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'
@AurelienGasser AurelienGasser changed the title Regression: vercel build fails with pnpm v9 on latest Vercel CLI Regression: vercel build fails with pnpm v9.1.0 on latest Vercel CLI May 16, 2024
@Jarrku
Copy link

Jarrku commented May 16, 2024

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:

--
16:55:52.394 | Restored build cache
16:55:52.481 | Running "vercel build"
16:55:52.944 | Vercel CLI 34.1.10
16:55:53.120 | > Detected Turbo. Adjusting default settings...
16:55:54.739 | > Detected ENABLE_EXPERIMENTAL_COREPACK=1 and "pnpm@9.1.1" in package.json
16:55:55.008 | Running "install" command: `pnpm install`...
16:55:55.703 | Scope: all 18 workspace projects
16:55:59.584 |  
16:55:59.701 | ../../../.. prepare$ husky
16:55:59.784 | ../../../.. prepare: Done
16:56:00.103 | Done in 4.9s

Logs I'm getting now:

Restored build cache
01:09:24.816 | Running "vercel build"
01:09:25.254 | Vercel CLI 34.2.0
01:09:25.403 | > Detected Turbo. Adjusting default settings...
01:09:25.845 | > Detected ENABLE_EXPERIMENTAL_COREPACK=1 and "pnpm@9.1.1" in package.json
01:09:26.107 | Detected `pnpm-lock.yaml` version 9 generated by pnpm 9
01:09:26.107 | Running "install" command: `pnpm install`...
01:09:26.660 | WARN  This project is configured to use v9.1.1 of pnpm. Your current pnpm is v9.0.4
01:09:26.662 | ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)
01:09:26.663 |  
01:09:26.663 | Your pnpm version is incompatible with "/vercel/path0".
01:09:26.663 |  
01:09:26.663 | Expected version: ^9.1.1
01:09:26.663 | Got: 9.0.4
01:09:26.663 |  
01:09:26.663 | This is happening because the package's manifest has an engines.pnpm field specified.
01:09:26.663 | To fix this issue, install the required pnpm version globally.
01:09:26.663 |  
01:09:26.663 | To install the latest version of pnpm, run "pnpm i -g pnpm".
01:09:26.663 | To check your pnpm version, run "pnpm -v".
01:09:26.676 | Error: Command "pnpm install" exited with 1

@AurelienGasser AurelienGasser changed the title Regression: vercel build fails with pnpm v9.1.0 on latest Vercel CLI Regression: vercel build fails with pnpm v9.1 on latest Vercel CLI May 16, 2024
@AurelienGasser AurelienGasser changed the title Regression: vercel build fails with pnpm v9.1 on latest Vercel CLI Regression: vercel build fails with pnpm v9.1.x on latest Vercel CLI May 16, 2024
@wweaver
Copy link

wweaver commented May 17, 2024

Is this something that would likely get fixed today? My team needs to deploy something. Just wondering if I have to remove corepack, or pin the version to 9.0.4 for now instead of a newer version.

@EndangeredMassa
Copy link
Contributor

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 pnpm by default. These can change, but right now, we support these versions of pnpm:

  • pnpm@6.35.1
  • pnpm@7.33.5
  • pnpm@8.15.8
  • pnpm@9.0.4

The proper matching major version is used based on the lockfile version and the package.json#packageManager version (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_ENGINE

For anyone seeing the ERR_PNPM_UNSUPPORTED_ENGINE error from pnpm, you can work around this problem by doing any of the following:

  • enable corepack (vercel docs)
    • set env var ENABLE_EXPERIMENTAL_COREPACK to 1
    • make sure you have a matching package.json#packageManager value
  • remove your package.json#engines.pnpm value (pnpm docs)

cc @Jarrku

pnpm error ERR_PNPM_BAD_PM_VERSION

For anyone seeing the ERR_PNPM_BAD_PM_VERSION error from pnpm, you can work around this problem by doing any of the following:

  • enable corepack (vercel docs)
    • set env var ENABLE_EXPERIMENTAL_COREPACK to 1
  • disable corepack strictness (pnpm docs) (corepack docs)
    • set env var COREPACK_ENABLE_STRICT to 0
    • this is necessary even if you aren't using corepack because pnpm checks this value
  • disable package manager strictness (pnpm docs)
    • set package-manager-strict to false in .npmrc

cc @AurelienGasser

@Jarrku
Copy link

Jarrku commented May 17, 2024

@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?

@EndangeredMassa
Copy link
Contributor

EndangeredMassa commented May 17, 2024

@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_ENGINE

If you see both these items in your logs:

  • Detected ENABLE_EXPERIMENTAL_COREPACK=1 ...
  • ERR_PNPM_UNSUPPORTED_ENGINE

Then 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.

@wweaver
Copy link

wweaver commented May 17, 2024

@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_ENGINE

If you see both these items in your logs:

  • Detected ENABLE_EXPERIMENTAL_COREPACK=1 ...
  • ERR_PNPM_UNSUPPORTED_ENGINE

Then you have a special case of this error. We're diagnosing this problem know. 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.

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.

cruisecritic-com_–_Deployment_Overview

@Jarrku
Copy link

Jarrku commented May 17, 2024

@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?

@wweaver
Copy link

wweaver commented May 24, 2024

Could this be a next issue? Or the fact of having a global pnpm installed along with the corepack one and next is using the global one? The reason I say that is because we have a vercel build for storybook that's not using next and it doesn't have an issue. It uses corepack and it's not failing with the same error labeled here. For now I turned off strictness of the package manager in the vercel setting for our nextjs builds.

@wweaver
Copy link

wweaver commented May 24, 2024

Actually, did this get resolved? I'm not getting the warning any longer. I just tried to disable laxness of pnpm version and it seems like it's working again.

@markoftw
Copy link

Doesn't seem to be solved yet, tried with the latest PNPM 9.1.3 and the issue persists.

@FleetAdmiralJakob
Copy link

FleetAdmiralJakob commented May 27, 2024

Doesn't seem to be solved yet, tried with the latest PNPM 9.1.3 and the issue persists.

This isnt about a problem from pnpm. pnpm made a design decision that was challenged now by vercel and until the poll on Twitter is over I think there will be no fix on the vercel side.

@EndangeredMassa
Copy link
Contributor

pnpm error ERR_PNPM_BAD_PM_VERSION

We've rolled out a change that disables pnpm@9's strictness when checking the package.json#packageManager value. You can still enable this strictness in your project by setting package-manager-strict to true in 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_ENGINE

We'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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants