ERR_PNPM_OUTDATED_LOCKFILE cicd dependency_management ai_generated true

ERR_PNPM_OUTDATED_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json

ID: cicd/pnpm-lockfile-mismatch

Also available as: JSON · Markdown
92%Fix Rate
94%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

pnpm install --frozen-lockfile failed because pnpm-lock.yaml does not match package.json. A dependency was added, removed, or changed in package.json without running pnpm install to update the lockfile.

generic

Workarounds

  1. 95% success Run pnpm install locally and commit the updated lockfile
    Run pnpm install locally after any package.json changes. Verify pnpm-lock.yaml was updated. Commit both package.json and pnpm-lock.yaml together.
  2. 88% success Ensure CI and local pnpm versions match
    Pin the pnpm version in package.json: { "packageManager": "[email protected]" }. In CI, use corepack enable to install the matching version. Version mismatches between local and CI can cause lockfile format differences.

Dead Ends

Common approaches that don't work:

  1. Removing --frozen-lockfile from the CI command 70% fail

    Without frozen-lockfile, CI installs potentially different versions than local development, leading to 'works on my machine' issues and non-reproducible builds

  2. Deleting pnpm-lock.yaml and regenerating it in CI 80% fail

    This defeats the purpose of a lockfile. CI would install the latest compatible versions, which may differ from what was tested locally.

Error Chain

Leads to:
Preceded by:
Frequently confused with: