Corepack vs nvm: Pinning Node Tooling Compared
These are not really competitors: nvm pins the Node.js runtime version, while Corepack pins which package manager (and version) the project uses. Most teams use both together.
Corepack and nvm are often mentioned together but solve different problems. nvm (Node Version Manager) installs and switches Node.js versions on a machine. Corepack ships with Node.js and manages the package manager: it reads the packageManager field in package.json and provisions the exact pnpm/Yarn version. Knowing which one to reach for avoids confusion in CI.
| Corepack | nvm | |
|---|---|---|
| Pins | Package manager + version | Node.js version |
| Source of truth | packageManager in package.json | .nvmrc or command |
| Ships with Node | Yes (bundled) | No (install separately) |
| Scope | pnpm, Yarn (npm too) | The Node runtime itself |
| Typical CI use | corepack enable | nvm install / setup-node |
| Replaces | Manually installing pnpm/Yarn | System Node, OS packages |
They complement, not compete
Use nvm (or your CI setup-node step) to get the right Node.js version, then use Corepack to get the right package manager version. Setting "packageManager": "pnpm@9.x" plus corepack enable guarantees every developer and runner uses the same pnpm, which prevents lockfile churn from version drift.
In CI
On GitHub Actions, actions/setup-node handles the Node version (covering nvm-style needs) and supports caching. Enabling Corepack (corepack enable) then makes the pinned package manager available without a manual install step, so CI matches local exactly. This pairing removes "works on my machine" mismatches caused by differing pnpm/Yarn versions.
Honest caveats
Corepack only governs the package manager, not Node itself, so it cannot replace nvm/setup-node. Corepack has had release and signature changes across Node versions, so pin and test it. nvm is shell-based and slower to switch than some alternatives (fnm, mise), but it is the most widely documented.
The verdict
Do not choose one over the other. Use nvm or setup-node for the Node.js version and Corepack for the package manager version. Together they make Node toolchains reproducible across machines and CI.