如何解决这种情况Error erresolve无法解决



运行npm install后,首先我得到了jasmine-core的错误。

解决后,我得到这个错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: client@0.0.0
npm ERR! Found: @angular/compiler@11.0.9
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"^11.0.7" 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.7" 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.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! @angular/platform-browser-dynamic@"^11.0.7" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/compiler@11.2.14
npm ERR! node_modules/@angular/compiler
npm ERR!   peer @angular/compiler@"11.2.14" from @angular/platform-browser-dynamic@11.2.14
npm ERR!   node_modules/@angular/platform-browser-dynamic
npm ERR!     @angular/platform-browser-dynamic@"^11.0.7" 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 /home/salami/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/salami/.npm/_logs/2021-09-25T09_49_52_657Z-debug.log

我做错了什么或者应该修复什么?

我将添加我的包。

更新:

使用——force运行后,我现在得到这个错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: client@0.0.0
npm ERR! Found: @angular/common@11.2.14
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^11.0.7" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^12.0.0 || ^13.0.0-0" from @angular/cdk@12.2.7
npm ERR! node_modules/@angular/cdk
npm ERR!   peer @angular/cdk@"^12.0.0" from @angular/flex-layout@12.0.0-beta.35
npm ERR!   node_modules/@angular/flex-layout
npm ERR!     @angular/flex-layout@"*" 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 /home/salami/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/salami/.npm/_logs/2021-09-25T12_07_03_361Z-debug.log

THis is my package.json

{
"name": "client",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^11.0.7",
"@angular/common": "^11.0.7",
"@angular/compiler": "^11.0.7",
"@angular/core": "^11.0.7",
"@angular/forms": "^11.0.7",
"@angular/platform-browser": "^11.0.7",
"@angular/platform-browser-dynamic": "^11.0.7",
"@angular/router": "^11.0.7",
"core-js": "^3.6.5",
"rxjs": "^6.6.0",
"tslib": "^2.3.1",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1100.6",
"@angular/cli": "^11.0.6",
"@angular/compiler-cli": "~11.0.7",
"@angular/language-service": "~11.0.7",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.8",
"@types/node": "^14.0.14",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.10.2",
"tslint": "~6.1.2",
"typescript": "~4.0.5"
}
}

如果发生依赖冲突,请尝试使用以下--force参数运行:

npm install --legacy-peer-deps --force

相关内容

  • 没有找到相关文章

最新更新