【问题标题】:How can resolve this situation Error ERESOLVE could not resolve [duplicate]如何解决这种情况错误 ERESOLVE 无法解决 [重复]
【发布时间】:2021-11-18 07:56:18
【问题描述】:

在运行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

我做错了什么或应该纠正什么?

如果需要,我会添加我的 package.json 文件。

更新:

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

这是我的 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"
  }
}

【问题讨论】:

标签: node.js angular npm


【解决方案1】:

更新:

在这种情况下会发生依赖冲突。

尝试使用--force 参数运行如下:

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

【讨论】:

  • 立即查看@potter-potter
猜你喜欢
  • 2011-04-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-07
  • 1970-01-01
  • 2011-06-21
相关资源
最近更新 更多