npm ci

I recently discovered npm ci which you can use instead of npm install when running a node project on continuous integration (CI) system and want to install your npm dependencies. It does this in a more lightweight, more CI friendly way.

If you use npm test to run your tests, this can be shortened to npm t (much like npm i is npm install), and therefore you can run npm cit to install dependencies and run tests in CI.

One thought on “npm ci”

  1. Looking at the documentation it says that if the `node-modules` directory is already present when you run `npm ci` it removes it first. That sounds counter-productive if you have the directory contents cached already. Is a fresh install fast enough to be worth the trade-off?

    Like

Comments are closed.