Corepack fails with Cannot find matching keyid when it fetches pnpm or yarn
Error: 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.
Fix it fast
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 --version2Match what you see, then jump to its fix
- 1
corepack --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
The 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
The 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
- 1
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 --version2Fix
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 enable3Verify
Run the package manager that failed.
corepack --version
pnpm --versionConfirmed by github.com
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.json2Fix
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-lockfileConfirmed by github.com
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-lockfile3Verify
The install finishes without the keyid error.
pnpm --versionConfirmed by github.com
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 fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack 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 fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fixBack end
The command npm run build -- --prod exited with code 1 (Angular)
The command "npm run build -- --prod" exited with code 1
Exit code 1 only says the build failed; the real message is above it.
2 causes, each with a fix