Skip to content
Latchkey

pnpm install in CI

pnpm installs from a global content-addressed store, hard-linking into node_modules.

pnpm is fast in CI because packages are cached once per machine. Use --frozen-lockfile for reproducible installs.

Common flags

  • --frozen-lockfile - fail if lockfile would change (default in CI)
  • --prefer-offline - use the store first
  • --store-dir - set store location for caching

Example in CI

Reproducible install.

shell
pnpm install --frozen-lockfile

In CI

Cache the pnpm store (pnpm store path) keyed on the lockfile. ERR_PNPM_OUTDATED_LOCKFILE means commit your updated pnpm-lock.yaml.

Key takeaways

  • --frozen-lockfile is the CI default.
  • Cache the pnpm store for speed.
  • Outdated-lockfile errors mean commit the lock.

Related guides

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