Difference between npm i and npm ciNodeJS
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 ?
This is an alias for
npm i command is used to install all
devDependencies from a package.json file.
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
devDependencies from a package-lock.json file.
Differences between npm i and npm ci
|npm i||npm ci|
|It is slower in execution||It is faster in execution|
|The project just need a package.json||The project must have an existing package-lock.json|
|It may write to package.json or package-lock.json||It will never write to package.json or package-lock.json: installs are essentially frozen.|
|Individual dependencies can be added||Individual dependencies cannot be added|
|If any dependency is not in package-lock.json, ||If dependencies in the package-lock.json do not match those in package.json, |
|If a node_modules is already present, ||If a node_modules is already present, it will be automatically removed before |
|It can install global packages||It can not install global packages|
See official documentations :
Back to Top