Difference between npm ci and npm i

npm ci is used in automated environments: test platforms, continous integration, and deployment.

npm ci will be faster when:

  • There is a package-lock.json
  • The node_modules is missing or empty

If dependencies in package-lock.json don't match those in package.json, npm ci will exit with an error. npm ci can only install entire projects (individual dependencies can't be added with this command).

More info here.

If npm ci is failing with exit code1 in GitHub (because warnings are treated as errors), add CI: "" on the workflow file:

# Installs npm
- run: npm ci 

# Builds the project
- run : npm run build
    CI: ""

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.