pnpm ERR_PNPM_LOCKFILE_CONFIG_MISMATCH in CI - Fix Settings Drift
pnpm records the settings that shaped the lockfile (hoisting, public-hoist patterns, registry). ERR_PNPM_LOCKFILE_CONFIG_MISMATCH means the current run uses different settings than the committed lockfile.
What this error means
pnpm install --frozen-lockfile fails with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH, indicating the .npmrc or pnpm settings in CI differ from those used to generate pnpm-lock.yaml.
pnpm
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH Cannot proceed with the frozen
installation. The current configuration does not match the value found
in the lockfile (e.g. hoist-pattern, public-hoist-pattern).Common causes
CI .npmrc differs from the local one
A different hoist-pattern, node-linker, or registry setting in CI conflicts with the settings baked into the lockfile.
pnpm settings changed without regenerating the lockfile
An .npmrc edit landed without re-running pnpm install, so the lockfile still encodes the old config.
How to fix it
Align the config and regenerate
- Make the CI .npmrc match the one used to build the lockfile.
- If the new settings are intended, regenerate the lockfile locally and commit it.
Terminal
pnpm install
git add pnpm-lock.yaml .npmrc
git commit -m "Sync pnpm config and lockfile"How to prevent it
- Commit a single .npmrc that local and CI share, regenerate the lockfile whenever pnpm settings change, and pin the pnpm version so config and lockfile stay in lockstep.
Related guides
pnpm ERR_PNPM_LOCKFILE_BREAKING_CHANGE - Fix Incompatible Lockfile Format in CIFix pnpm ERR_PNPM_LOCKFILE_BREAKING_CHANGE in CI - the committed pnpm-lock.yaml uses a format version the ins…
pnpm ERR_PNPM_OUTDATED_LOCKFILE in CI - Fix Lockfile Out of SyncFix ERR_PNPM_OUTDATED_LOCKFILE in CI by regenerating and committing pnpm-lock.yaml, since pnpm install --froz…
npm lockfileVersion Mismatch in CI - Fix package-lock Version ConflictsFix npm lockfileVersion mismatches in CI by aligning the npm version that reads the lockfile with the version…