May 3, 2023
npm ci versus npm install
If you want to install node packages with npm, there is also another command as the npm install. The npm ci command install packages, but with some differences:
npm ci
- Can not generate a
package-lock.json, but requires it. - Removes installed packages and installs them in the same version again.
- Useful, when there is the need to reinstall packages without updating them.
- https://docs.npmjs.com/cli/v9/commands/npm-ci
npm install
- Can generate a
package-lock.json. - Depending on the on the
package.jsonconfiguration, it can update packages to newer versions. - Useful to initinally install packages or to update them.
- https://docs.npmjs.com/cli/v9/commands/npm-install