New corepack lockfile check is too strict

Error: Detected package manager “yarn” does not match intended corepack defined package manager “pnpm”. Change your lockfile or “package.json#packageManager” value to match.

I recognize that this is a useful check, I think it should be a warning rather than an error. The build system should use what’s configured manually by the user in the package.json#packageManager property.

For others, I worked around it by disabling corepack (remove the ENABLE_EXPERIMENTAL_COREPACK environment variable) and updating my installCommand, but I’d rather use the built-in corepack feature.

  "installCommand": "npm i -g pnpm@9.0.4 && pnpm install"

Hi @mdean400 ,

It sounds like you might have yarn.lock file in your project repository which is overriding behavior of COREPACK. If you can replace yarn.lock with pnpm-lock.yaml and push it to Vercel, it should pick the right version.

Let us know how it goes!

2 Likes

Yeah, I do have a yarn.lock file in my repository, in addition to a pnpm-lock file, but the yarn.lock file is required for my monorepo to deploy to another cloud provider. I think that users who are deep enough in the ecosystem to be using corepack know what they’re doing when they specify a packageManager and shouldn’t be blocked.

It’s been working for quite a while but broke recently. I think the new check should warn but not error.