My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
NPM CI: A Command You Should Know

NPM CI: A Command You Should Know

Florian Hämmerle's photo
Florian Hämmerle
·Nov 26, 2018

NPM 5.7.0 introduced the new npm ci command. It's a faster, more reliable way of installing dependencies on test environments, continuous integration or during deployment. npm ci comes with some benefits over npm install, but also with some pre-requirements:

  • 🏎 it's faster  -  some report a 2–5x speed improvement of their CI
  • ☝️ it can only install whole projects, not single dependencies
  • 👉 it only considers package-lock.json, make sure the file is checked in!
  • 👌 if package.json and package-lock.json do not match, an error occurs
  • 💪 it never updates package.json or package-lock.json
  • 👍 it throws away existing node_modules and starts with a clean slate

Some of these improvements have since found its way to well-known npm install. The official docs for the npm ci command can be found here and the introductory blog post from March can be read here.

It's time to update your Dockerfile, .travis.yml, and other configurations that can benefit from faster installs.