npm ci is a command in the npm CLI that Installs a project with a clean slate. This command is similar to npm-install, except it’s meant to be used in automated environments. This tag should be used for questions specifically relating to the npm ci command, and not the npm install command.
Questions tagged [npm-ci]
38 questions
664
votes
9 answers
What is the difference between "npm install" and "npm ci"?
I'm working with continuous integration and discovered the npm ci command.
I can't figure what the advantages are of using this command for my workflow.
Is it faster? Does it make the test harder, okay, and after?

Webwoman
- 10,196
- 12
- 43
- 87
217
votes
4 answers
npm: When to use `--force` and `--legacy-peer-deps`
I'm trying to understand how recreating the node_modules directory for deployment works.
We're using npm ci instead of npm install to ensure a clean slate during deployment. However, when we run it without any flags, we get the following error:
Fix…

Floating Sunfish
- 4,920
- 5
- 29
- 48
72
votes
2 answers
Is there a way of making "npm ci" install devDependencies, or "npm install" not update package-lock.json?
I'm trying to put together documentation for new developers installing our codebase on their local development environments. I'd like to give them command(s) that:
Installs both devDependencies and dependencies based on the versions in…

josh
- 9,038
- 8
- 31
- 37
32
votes
2 answers
pnpm equivalent command for npm ci
What is the equivalent command for npm ci in pnpm?
According to the documentation for npm install:
pnpm install is used to install all dependencies for a project.
In a CI environment, installation fails if a lockfile is present but needs an…

BuZZ-dEE
- 6,075
- 12
- 66
- 96
29
votes
5 answers
How I can skip installing optional dependencies by 'npm ci'?
How I can skip installing optional dependencies from package-lock.json by npm ci?

art201214
- 437
- 1
- 4
- 10
14
votes
2 answers
Using "npm ci" instead of "npm install" for deterministic project setup
Given a project where the package-lock.json is managed in source control with the goal that all developers on the team get exactly the same dependencies.
From the documentation of npm I think developers should use npm ci to set up their development…

jbandi
- 17,499
- 9
- 69
- 81
6
votes
1 answer
GitHub action fails on npm ci
I have git action to run prettier(Code formatter). Below is the format.yml file of git action.
name: Format code with prettier
on:
push:
branches-ignore:
- master
jobs:
format:
runs-on: ubuntu-latest
steps:
- name:…

Nidhi Dadiya
- 798
- 12
- 31
5
votes
3 answers
npm ci giving Conflicting peer dependency
I am trying to install the dependencies from docker file with command RUN npm ci. But I am getting the following error Conflicting peer dependencies. Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to…

JN_newbie
- 5,492
- 14
- 59
- 97
5
votes
1 answer
Did "npm install" become deterministic in npm 7?
Here https://github.blog/2021-02-02-npm-7-is-now-generally-available/
it's said:
The lockfile v2 unlocks the ability to do deterministic and reproducible builds to produce a package tree.
But I wonder is it the default behavior now for npm 7? That…

RussCoder
- 889
- 1
- 7
- 18
4
votes
0 answers
couldn't run npm ci
node.js - v12.16.2
npm - 6.14.4
OS - windows 10
When I run npm ci i get error.
The complete error log:
npm WARN prepare removing existing node_modules/ before installation
> fsevents@1.2.4 install G:\Agrima\workspace\VoTT\node_modules\fsevents
>…

Sai Krishnadas
- 2,863
- 9
- 36
- 69
3
votes
1 answer
When npm install/ci honors package-lock.json, is there any purpose of using tilde(~) and caret(^) in package.json?
In case an application has a package-lock.json or shripkwrap.json, both npm install/npm ci command would honor the dependencies versions (in package-lock.json or shripkwrap.json), what purpose would tilde(~) and caret(^) serve in package.json?

mavHarsha
- 1,056
- 10
- 16
3
votes
0 answers
Running "npm ci" when building docker image is much slower
I tried to run npm ci command using the same package.json and package-lock.json files in three different environments:
docker host machine - takes ~27s to complete
inside a docker container - takes ~32s to complete
during building a docker image -…

Pavels Ahmadulins
- 430
- 5
- 16
3
votes
2 answers
NPM prune after NPM ci
I have an innocent question :is there some interest to do a npm prune after a npm ci ? For me npm ci seems to be sufficient, no ?
Thanks by advance

Hulkito Nol
- 53
- 4
2
votes
3 answers
npm ci fails in Github Action
I am working on a pipeline to install npm packages using GitHub Actions, I am getting this error:
npm ERR! code EUSAGE
npm ERR!
npm ERR! The `npm ci` command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with…

learner
- 61
- 6
2
votes
1 answer
Azure Devops: The given cache key has changed in its resolved value between restore and save steps;
I am struggling with one warning which shows in Azure Devops.
##[warning]The given cache key has changed in its resolved value between restore and save steps;
original key: npm|"Linux"|1hQ5erTp1F2VHRtmwbSGxyt5NqLK6CNbXboa/qqfKiE=
modified key:…

Józef Podlecki
- 10,453
- 5
- 24
- 50