Skip to content
Latchkey

corepack enable: Pin Your Package Manager

Corepack activates the package manager and version your repo declares.

The packageManager field plus corepack enable guarantees CI uses the same yarn/pnpm version as developers, eliminating a class of version-mismatch errors.

Common usage

  • corepack enable - activate shims
  • "packageManager": "pnpm@9.1.0" in package.json
  • corepack prepare <pm>@<v> --activate

Example in CI

Enable before install so the pinned manager is used.

shell
corepack enable && pnpm install --frozen-lockfile

In CI

With Corepack you do not need a separate setup-pnpm/yarn step. The packageManager field is the single source of truth.

Key takeaways

  • Corepack pins yarn/pnpm via packageManager.
  • Run corepack enable before install.
  • No separate setup step needed.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →