node.js - npm install --force 和 npm install --legacy-peer-deps 有什么区别?
问题描述
我正在尝试使用npm install
. 但它失败了。
错误日志:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-first-app@0.0.0
npm ERR! Found: @angular/compiler@11.0.9
npm ERR! node_modules/@angular/compiler
npm ERR! @angular/compiler@"~11.0.0" from the root project
npm ERR! peer @angular/compiler@"11.0.9" from @angular/compiler-cli@11.0.9
npm ERR! node_modules/@angular/compiler-cli
npm ERR! dev @angular/compiler-cli@"~11.0.0" from the root project
npm ERR! peer @angular/compiler-cli@"^11.0.0" from @angular-devkit/build-angular@0.1100.7
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1100.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"11.1.2" from @angular/localize@11.1.2
npm ERR! node_modules/@angular/localize
npm ERR! peerOptional @angular/localize@"^11.0.0" from @angular-devkit/build-angular@0.1100.7
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1100.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/amit/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/amit/.npm/_logs/2021-02-04T17_58_24_981Z-debug.log
日志建议使用npm install --force
或npm install --legacy-peer-deps
npm install --force
我想了解和之间的基本区别npm install --legacy-peer-deps
。
此外,如果性能--force
优于--legacy-peer-deeps
或反之亦然,则更优选使用哪一个?
任何建议/指针都非常值得赞赏。谢谢!
解决方案
推荐阅读
- angular - 架构验证失败
- swift - 检查字典是否是另一个字典的子项
- powershell - Powershell - 将测试用例从 TFS 迁移到 Azure DevOps 的脚本
- excel - 对未指定的列范围进行平均时遇到问题
- c# - SKBitmap.Decode(imageStream) 返回 null
- facebook - Facebook SDK - 获取潜在客户的详细信息 - ASP .net 核心 API
- python - 将多个不同长度的时间序列合并为一个二维矩阵
- javascript - 循环遍历无序列表以添加和删除类
- reactjs - 如果 JSON 文件中没有日期,则 fetch 语句返回的 responseJson 的值是多少
- angularjs - 在angularjs中插入后重定向页面时如何传递参数?