【发布时间】:2022-08-12 11:11:58
【问题描述】:
我正在尝试使用命令RUN npm ci 从 docker 文件安装依赖项。但我收到以下错误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.。在我的本地项目中,我在运行npm install --force 时克服了这个问题。在构建和运行此命令RUN npm ci 时,如何在 docker 中解决此问题。
据我了解,npm ci 将从 package-lock.json 或 npm-shrinkwrap.json 中查看它。但仍然面临这个问题。无法弄清楚是什么原因造成的。
-
您能否在非 Docker 开发环境中修复依赖项(没有“强制”选项),将
package.json和package-lock.json/yarn.lock文件提交到源代码控制,然后使用正确的锁定重建 Docker 映像文件? -
@DavidMaze 在我的非 Docker 开发环境中我也面临这个问题(没有“强制”选项)
-
@DavidMaze 在我的非 Docker 开发环境中不使用 --force 选项我得到
Could not resolve dependency: Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution. -
现在我已经通过将 npm 版本的依赖项安装为 6 来修复它。看起来我需要锻炼以更新其余的依赖项,以使其在没有 --force 的情况下工作,如果 npm 版本大于 6
标签: node.js docker npm npm-install npm-ci