Run npm ci in CI, not npm install, for locked dependency installs
npm ci installs exact versions from package-lock.json and fails if the lockfile is out of sync, making it ideal for CI pipelines.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
npm ci installs exact versions from package-lock.json and fails if the lockfile is out of sync, making it ideal for CI pipelines.
Choose npm install for flexible local development and npm ci for reproducible CI builds. Compare lockfile handling, speed, and failure modes to avoid drift between environments.
npm install resolves and can change your dependency tree; npm ci reproduces the lockfile exactly. A decision guide with a behavior comparison, CI implementation, and validation checks.
Why committing package-lock.json and building with npm ci is one of the highest-leverage decisions in a JavaScript repo — and where npm install still belongs.
Lockfile Validation Component The npm ci command is designed for automated environments to ensure reproducible builds by installing dependencies exactly as defined in the lockfile. Unlike npm install , which may reconcile and update the lockfile to match the manifest, npm ci requires a strict synchronization between package.json and package-lock.json . When
Updating a project from npm v6 to npm v7 or later triggers an automatic migration of the package-lock.json file to lockfileVersion: 2 . This version change is designed to support new features like native workspaces and improved dependency resolution. The primary constraint is maintaining environment parity across development machines and legacy CI/CD pipelin
A team wants a single package-lock.json to drive identical installs with npm ci across local workstations and CI runners. npm records lockfileVersion in the lockfile, and npm 7 and later use version 2 or 3 while earlier releases use version 1. It is unclear whether npm ci rejects a lockfile written by a different major npm release, or whether it silently rew