CalcSnippets Search
JavaScript 1 min read

`pnpm install --frozen-lockfile` Is the Command You Should Use When You Want Installs to Match the Lockfile Instead of Silently Rewriting History

A practical guide to `pnpm install --frozen-lockfile` for reproducible installs in CI and team workflows where the lockfile should be treated as a contract, not a suggestion.

Why this command matters: dependency installs are much less trustworthy when the package manager is allowed to “helpfully” rewrite the lockfile behind your back.

If your project uses pnpm and you care about reproducibility, --frozen-lockfile is one of the most important install flags to know. It tells pnpm to respect the existing lockfile and fail if the install would require changes.

The command

pnpm install --frozen-lockfile

This is especially useful in CI, team onboarding, and release validation.

Why it matters

Without a frozen lockfile, installs can drift:

  1. a changed manifest may quietly mutate the lockfile
  2. one machine may resolve dependencies differently than another
  3. CI may succeed locally and fail later after lockfile churn

--frozen-lockfile turns that drift into an immediate failure instead of a delayed surprise.

Good use cases

Use it when:

  1. validating PRs in CI
  2. confirming the repo is in a consistent installable state
  3. ensuring a teammate committed the correct lockfile changes

It is less about convenience and more about refusing ambiguity.

Final recommendation

If the lockfile is meant to define the install state, enforce it with pnpm install --frozen-lockfile. It is one of the cleanest ways to stop dependency drift before it becomes someone else’s debug session.

Sources

Keep reading

Related guides