我正在尝试使用node_modules为一个项目安装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或反之亦然,那么使用哪一种更好呢?
任何建议/指示都是非常值得赞赏的。谢谢!
发布于 2022-09-30 11:13:03
两者之间的差异如下
--legacy-peer-deps:在安装时忽略所有peerDependencies,采用npm版本4的样式,直到版本6。
--strict-peer-deps:失败,并在遇到冲突的peerDependencies时中止安装过程。默认情况下,npm将导致由根项目的直接依赖关系引起的peerDependencies冲突崩溃。
即使磁盘上存在本地副本,--forces :也将强制npm获取远程资源。
https://stackoverflow.com/questions/66051520
复制相似问题