Corepack "this project is configured to use yarn" in CI - Fix Package Manager Mismatch
Corepack pins a package manager via the packageManager field. When you run a different manager than the one declared, Corepack refuses and tells you which one the project expects.
What this error means
A CI step running npm or pnpm errors saying this project is configured to use yarn (or a specific version), because packageManager in package.json pins a different tool than the command invoked.
yarn
Usage Error: This project is configured to use yarn because
package.json#packageManager is set to "yarn@4.1.0".
Run "corepack enable" to make the command work.Common causes
The job runs a manager other than the pinned one
packageManager pins yarn (or pnpm), but the CI step calls npm, so Corepack blocks it.
Corepack is not enabled in CI
Without corepack enable, the pinned manager shim is not on PATH and the command fails.
How to fix it
Enable Corepack and use the pinned manager
- Run corepack enable so the pinned shims are available.
- Invoke the manager named in packageManager.
Terminal
corepack enable
yarn install --immutableChange packageManager if the project really uses npm
- Update or remove the packageManager field to match your actual tool.
- Commit the change so CI and local agree.
How to prevent it
- Pick one package manager, pin it in packageManager, run corepack enable in CI, and use that same manager in every script so commands never get blocked.
Related guides
corepack enable "EACCES permission denied" - Fix Shim Install in CIFix "corepack enable" failing with EACCES in CI/Docker - Corepack cannot write yarn/pnpm shims into a Node bi…
Corepack "Signature verification failed" / Cannot Download - Fix in CIFix Corepack errors in CI - "Cannot find matching keyid" / signature verification failed or a failed package-…
yarn --frozen-lockfile Outdated in CI - Fix Lockfile Out of SyncFix yarn install --frozen-lockfile failures in CI when the lockfile is out of date, by regenerating and commi…