Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Corepack fails with Cannot find matching keyid when it fetches pnpm or yarn

ErrorError: Cannot find matching keyid: {...}

Short answer

Corepack checks package-manager downloads against npm's signing keys. Cannot find matching keyid means the key that signed the new release is not in your Corepack's built-in list, because npm rotated keys and your Corepack is old. Update Corepack with npm install -g corepack@latest and pin your package manager in package.json.

  • Applies to Node.js 22, Corepack 0.31 and newer, pnpm 10
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the Corepack version that is actually first on PATH. A stale copy there is the usual reason the error survives an upgrade.

    corepack --version
    which corepack
    node --version
  2. 2Match what you see, then jump to its fix

    1. 1corepack --version is older than 0.31.0 and the error starts when a new pnpm or yarn version is publishedThe Corepack that ships with your Node.js is too oldFix
    2. 2The error shows right after a new pnpm release, in builds that did not changeThe packageManager field is missing, so Corepack downloads the latest versionFix
    3. 3The build must run on a fixed base image or buildpack that you cannot change todayYou cannot update Corepack right now and need the build to passFix

What does the error look like?

  • Error: Cannot find matching keyid: {...}
  • pnpm: Error: Cannot find matching keyid

Cause 1 of 3

The Corepack that ships with your Node.js is too old

1Check

npm rotated the keys that sign packages on its registry. Corepack releases from before the rotation do not know the new key, and CI or Docker images usually have no cached package manager, so they download a fresh signed one.

corepack --version

2Fix

Install a current Corepack in the build, before you enable it. Or move to a Node.js release that bundles a newer one.

npm install -g corepack@latest
corepack enable

3Verify

Run the package manager that failed.

corepack --version
pnpm --version

Confirmed by github.com

Did this fix it?

Cause 2 of 3

The packageManager field is missing, so Corepack downloads the latest version

1Check

Look for the packageManager field in package.json. Without a pinned version and hash, a fresh environment fetches whatever is newest.

grep -n packageManager package.json

2Fix

Pin the exact version in package.json (Corepack documents the form name@x.y.z, with an optional hash that is strongly recommended). Pinning means a later key rotation does not change what CI downloads.

// package.json (example version: use the one you run today)
"packageManager": "pnpm@10.0.0"

3Verify

Run a clean install, as CI does.

rm -rf node_modules
pnpm install --frozen-lockfile

Confirmed by github.com

Did this fix it?

Cause 3 of 3

You cannot update Corepack right now and need the build to pass

1Check

The Corepack README documents COREPACK_INTEGRITY_KEYS: empty or 0 skips the integrity check. The maintainers say Corepack still checks the download's shasum against the registry metadata, and that this is acceptable only if you trust HTTPS.

echo "${COREPACK_INTEGRITY_KEYS:-not set}"

2Fix

Use this only as a stop-gap, then remove it when Corepack is updated.

COREPACK_INTEGRITY_KEYS=0 pnpm install --frozen-lockfile

3Verify

The install finishes without the keyid error.

pnpm --version

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Pin packageManager with version and hash in package.json.
  • Update Corepack in your Dockerfile or build script instead of relying on the copy inside the Node.js image.
  • From Node.js 25 Corepack is no longer bundled, so install it explicitly in new pipelines.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Back end

ng serve cannot find the dev-server builder package

Could not find the implementation for builder @angular/build:dev-server

The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.