npm ci giving Conflicting peer dependency

7.7k views Asked by At

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 accept an incorrect (and potentially broken) dependency resolution.. In my local project I have overcome this issue while running npm install --force. How I can fix this inside the docker while building and running this command RUN npm ci.

As I have understood npm ci will look it either from the package-lock.json or npm-shrinkwrap.json. But still facing this issue. Cannot figure it out what is causing this.

3

There are 3 answers

0
KrisJuris On

I also started to get this error on pipe. What is interesting I always have had peer dependency conflict but it was only appearing with npm install. The best option is to run script with flag --legacy-peer-deps it will skip checking peer dependency. Peer dependency should be installed manually in package.json.

0
shaza On

npm i --force

solved my problem

Note : I got : added 482 packages, and audited 483 packages in 3m Some issues need review, and may require choosing a different dependency.

0
IronGeek On

They introduce a breaking changes in [email protected] (yes! a minor version bump, with a major breaking changes).

The update changes the behavior of package installation, both from npm install and npm ci.

Previously, the npm ci command would blindly install whatever was in the lock file. AS IS, it will validates both the package-lock.json and package.json is in a consistent state.

You could read more about the issue here: github.com/npm/cli/issues/4998, github.com/npm/cli/issues/5113, and github.com/npm/cli/issues/4664