While looking at some of our Azure Pipelines, I noticed that some of our builds were really slow. So I opened up one of the slow builds and noticed that most time was spend installing npm packages.
As we were using a local build agent, a first improvement you can make is to change the Clean settings to False so you don’t have to start with a clean working directory every time.
Another improvement you can make is to switch from using npm install
to npm ci
.
npm ci
was introduced a few years ago and promised massive improvements to both the performance and reliability of builds for continuous integration / continuous deployment processes.
It bypasses a package’s package.json
to install modules from a package’s lockfile. This not only makes npm ci
fast (sometimes twice as fast as using npm install
) it also helps to ensure reproducible builds—you are getting exactly what you expect on every install.