Speed up your Node CI Pipelines

Henry Steinhauer
Analytics Vidhya
Published in
2 min readJan 27, 2021

Today we’re going to talk about a small improvement that can make our node pipelines much faster.

Photo by CHUTTERSNAP on Unsplash

A few days ago I came across an npm command I had never read or heard of. Until then, I used npm install to prepare the environment with all dependencies in my continuous integration piplines. But after I had dealt with it a little bit and test it out, I was impressed. The pipelines were more than 30% faster.

before and after I changed to npm ci

npm ci

The command I am talking about is, as you can read in the headline, npm ci. But what does it actually do? Why is it so much faster? And what are the differences to npm install? Below you can see a list of the most important differences between npm install and npm ci.

  1. npm ci ignores the specified dependencies in package.json and only installs the dependencies from the package-lock.json file.
  2. If package.json and package-lock.json do not contain the same dependencies, an error is returned. The npm install command, on the other hand, would adjust the package-lock.json file.
  3. If a node_modules folder already exists, through npm ci it’ll be removed and completely recreated.
  4. The package.json and package-lock.json are frozen. Both will not change.

Through all that I listed above and more, npm ci is much faster than npm install. I can recommend everyone to try it in their ci. Not only because of the time improvement. Also because of the fact that an error is thrown if the package.json and package-lock.json don’t contain the same dependencies.

Final thoughts

Today we talked about npm ci and the difference to npm install. I hope the short article was helpful and you were able to take something away. If you have any questions or notes, please leave them in the comments.



Henry Steinhauer
Analytics Vidhya

Passionate software developer who enjoys exploring new programming languages, design patterns and frameworks.