This post hasn't been updated for 4 years
5.7.0 release NPM introduced new
npm ci command which allows to increase dependencies installation time significantly.
In order to achieve that, command ignores
package.json contents and runs installation only for versions locked in
package-lock.json file. In case those 2 files conflict with each other, it will throw an error.
In addition, it ignores contents of
node_modules and removes directory if it exists.
All of that allows to use the command on environments which require fastest execution: CI systems.
Let’s run some tests:
npm install -g [email protected] npm ci
Note that NPM 5.7.0 contains a serious error and must not be used.
In order to run the tests let's use the following configuration:
Node v8.9.4 NPM v5.7.1 Yarn v1.3.2
As you can see,
npm ci gives the best performance on dry-run and almost same performance as
yarn on cached run.
The release of NPM 5.7.1 is still marked as Pre-release, however it gives very promising results and is definitely worth trying if you experience serious delays with your CI systems.
All Rights Reserved