Skip to content

Error when upgrading pnpm to latest in devEngines.packageManager #874

Description

@karlhorky

If pnpm is previously set at a specific version such as 11.12.0 in devEngines.packageManager:

package.json

{
  "devEngines": {
    "packageManager": {
      "name": "pnpm",
      "version": "11.12.0+sha512.820a6fbd0d9f04c226638002aead1e45340a9139dd5dc077c1d83ef44aa2481c8eb6637b4c9aa696a3c7e35ba818e49cf27213e5f2b91138d09b7a3e26e898ba"
    }
  }
}

Then upgrading using corepack use pnpm@11.13.0 (or corepack use pnpm@latest) fails with a confusing error:

$ corepack use pnpm@11.13.0
Installing pnpm@11.13.0 in the project...
Usage Error: The requested version of pnpm@11.13.0+sha512.88d94724d8f2e6c186744a5584c6e59ecac869ec7ba15e9cb4cd628e8dc7066820b2481d8ee3b51ea8da323a7378068aa58c556a3720d32b7c20a051d088363a does not match the devEngines specification (pnpm@11.12.0+sha512.820a6fbd0d9f04c226638002aead1e45340a9139dd5dc077c1d83ef44aa2481c8eb6637b4c9aa696a3c7e35ba818e49cf27213e5f2b91138d09b7a3e26e898ba)

$ corepack use <pattern>

It appears to be caused by Corepack attempting to add a packageManager field for 11.13.0 which conflicts with devEngines.packageManager's version of 11.12.0.

Some projects only want to rely on devEngines.packageManager, instead of also using packageManager or duplicating the fields.

Could Corepack instead update the version in devEngines.packageManager and not attempt to add packageManager?

Related issues

It appeared at first that this was related to issue #729, but I think my issue here is narrower - about a specific failure case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions