如何从读取输出,以及如何解决npm依赖项冲突

6bc51xsx  于 2022-11-14  发布在  其他
关注(0)|答案(1)|浏览(262)

以下是我在尝试安装项目时遇到的错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @angular-devkit/build-ng-packagr@0.8.0
npm ERR! Found: tsickle@0.32.1
npm ERR! node_modules/tsickle
npm ERR!   tsickle@"^0.32.1" from @angular/compiler-cli@6.1.10
npm ERR!   node_modules/@angular/compiler-cli
npm ERR!     dev @angular/compiler-cli@"^6.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer ng-packagr@"^2.2.0 || ^3.0.0 || ^4.0.0" from @angular-devkit/build-ng-packagr@0.8.0
npm ERR! node_modules/@angular-devkit/build-ng-packagr
npm ERR!   @angular-devkit/build-ng-packagr@"^0.8.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: tsickle@0.46.3
npm ERR! node_modules/tsickle
npm ERR!   peer tsickle@">=0.34.0" from ng-packagr@4.7.1
npm ERR!   node_modules/ng-packagr
npm ERR!     peer ng-packagr@"^2.2.0 || ^3.0.0 || ^4.0.0" from @angular-devkit/build-ng-packagr@0.8.0
npm ERR!     node_modules/@angular-devkit/build-ng-packagr
npm ERR!       @angular-devkit/build-ng-packagr@"^0.8.0" from the root project

这是我的package.json

"dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "core-js": "^2.5.4",
    "rxjs": "~6.2.0",
    "sass": "^1.55.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.8.0",
    "@angular-devkit/build-ng-packagr": "^0.8.0",
    "@angular/cli": "~6.2.9",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "@typescript-eslint/eslint-plugin": "^4.31.2",
    "@typescript-eslint/parser": "^4.31.2",
    "codelyzer": "~4.3.0",
    "eslint": "^7.32.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~2.9.2"
  }

我大致了解到不同的包依赖于不同/冲突的版本,但我想学习/了解如何准确地读取输出。(例如,哪一行对应于包依赖关系,而不是它的对等包依赖关系。)
而且,由于安装失败,我无法检查每个包的package.json。那么,在哪里可以找到为特定包列出的特定依赖项呢?
提前感谢!

tkclm6bt

tkclm6bt1#

您可以使用npm install --legacy-peer-deps,在安装时忽略所有对等依赖项
但要小心,这将绕过peerDependency自动安装,并将增加引入破坏性更改的风险

相关问题