简体   繁体   English

npm ci 给出冲突的对等依赖

[英]npm ci giving Conflicting peer dependency

I am trying to install the dependencies from docker file with command RUN npm ci .我正在尝试使用命令RUN npm ci从 docker 文件安装依赖项。 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.但我收到以下错误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. 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 .在我的本地项目中,我在运行npm install --force时克服了这个问题。 How I can fix this inside the docker while building and running this command RUN npm ci .在构建和运行此命令RUN npm ci时,如何在 docker 中解决此问题。

As I have understood npm ci will look it either from the package-lock.json or npm-shrinkwrap.json.据我了解,npm ci 将从 package-lock.json 或 npm-shrinkwrap.json 中查看它。 But still facing this issue.但仍然面临这个问题。 Cannot figure it out what is causing this.无法弄清楚是什么原因造成的。

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.有趣的是,我一直有对等依赖冲突,但它只出现在 npm install 中。 The best option is to run script with flag --legacy-peer-deps it will skip checking peer dependency.最好的选择是运行带有标志 --legacy-peer-deps 的脚本,它将跳过检查对等依赖关系。 Peer dependency should be installed manually in package.json.对等依赖项应在 package.json 中手动安装。

npm i --force 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.注意:我得到:添加了 482 个包,并在 3m 中审核了 483 个包一些问题需要审查,并且可能需要选择不同的依赖项。

They introduce a breaking changes in npm@8.6 ( yes, a minor version bump, with a major breaking changes ).他们在npm@8.6中引入了一个重大更改(是的,一个小版本的改动,有一个重大的重大更改)。

The update changes the behavior of package installation, both from npm install and npm ci .此更新从npm installnpm ci更改了 package 安装的行为。

Previously, the npm ci command would blindly install whatever was in the lock file.以前, npm ci命令会盲目安装锁定文件中的任何内容。 AS IS, it will validates both the package-lock.json and package.json is in a consistent state.按原样,它将验证package-lock.jsonpackage.json是一致的 Z9ED39E2EA9342EFA7666

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 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

this cmd finally worked for me... atleast tried it这个 cmd 终于为我工作了......至少试过了

npm install --legacy-peer-deps npm 安装 --legacy-peer-deps

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM