Skip to content
Latchkey

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

  1. Make the CI .npmrc match the one used to build the lockfile.
  2. 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

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