npm install vs npm ci — What's the Difference?
npm install resolves and installs dependencies, potentially updating the lockfile if it doesn't match package.json exactly; npm ci installs strictly from the...
Published October 5, 2026
npm install resolves and installs dependencies, potentially updating the lockfile if it doesn't match package.json exactly; npm ci installs strictly from the existing lockfile and fails if it's out of sync, without ever modifying it.
Why they differ
- npm install is more forgiving and will adjust the lockfile to fit updated dependency ranges in package.json
- npm ci is stricter and faster (it deletes node_modules first for a clean install), designed specifically for reproducible automated environments like CI pipelines
How to choose
- Use npm install locally during normal development when you're actively adding or updating dependencies
- Use npm ci in CI/CD pipelines and production builds, where you want an exact, reproducible install matching the committed lockfile
FAQ
What happens if package.json and package-lock.json disagree during npm ci?
npm ci fails immediately with an error rather than trying to reconcile the difference — the lockfile must be regenerated with npm install first.