Difference between npm i and npm ci


Thanks to the very large open-source community around Node, it is possible for us to access many features already coded for us and install them very easily as dependencies in our projects.

npm is a Node package manager which will allow us to download, install, uninstall or update our packages within a project using its CLI.

npm ci is very useful in CI/CD pipelines, but what is the differences with npm install ?

npm i

This is an alias for npm install

The npm i command is used to install all dependencies or devDependencies from a package.json file.


npm i

npm ci

CI means Continuous Integration

This command is similar to npm i , except it's meant to be used in automated environments such as test platforms, continuous integration, and deployment. (Or any situation where you want to make sure you're doing a clean install of your dependencies).

npm ci is used to install all exact versions of dependencies or devDependencies from a package-lock.json file.


npm ci

Differences between npm i and npm ci

npm inpm ci
It is slower in executionIt is faster in execution
The project just need a package.jsonThe project must have an existing package-lock.json
It may write to package.json or package-lock.jsonIt will never write to package.json or package-lock.json: installs are essentially frozen.
Individual dependencies can be addedIndividual dependencies cannot be added
If any dependency is not in package-lock.json, npm i will add itIf dependencies in the package-lock.json do not match those in package.json, npm ci will exit with an error, instead of updating the package-lock.json
If a node_modules is already present, npm i doesn’t change anything to itIf a node_modules is already present, it will be automatically removed before npm ci begins its install
It can install global packagesIt can not install global packages

See official documentations :

Back to Top

I am actually playing with NextJS, some contents are not available yet ! See the v1