迁移失败:发现不兼容的对等依赖项

Migration failed: Incompatible peer dependencies found

我是 angular 的新手,正在尝试从 9.0.0 升级到 9.1.11 以将我的打字稿从 3.7.5 to 3.8 升级为在我的应用程序中使用国家/地区地图插件。

当我 运行 命令 ng update @angular/cli@9.1 @angular/core@9.1 我得到

Using package manager: 'npm' Collecting installed dependencies... Found 68 dependencies. Fetching dependency metadata from registry...
                  Package "yamapng" has an incompatible peer dependency to "@angular/common" (requires "^7.1.0" (extended), would install "9.1.12").
                  Package "yamapng" has an incompatible peer dependency to "@angular/core" (requires "^7.1.0" (extended), would install "9.1.12").
                  Package "angular-svg-round-progressbar" has an incompatible peer dependency to "zone.js" (requires "^0.9.0", would install "0.10.3"). × Migration failed: Incompatible peer dependencies found. Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together. You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.   See "C:\Users\koste\AppData\Local\Temp\ng-If5zs2\angular-errors.log" for further details.

如何自动升级所有软件包? 如果不可能,我会安全地升级其他插件吗?即使在互联网上查看其他相同的错误,我也不太理解这些错误。

我的package.json很简单

{
  "name": "vien-angular-start",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:prod": "ng build --configuration=production",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "ngcc"
  },
  "dependencies": {
    "@agm/core": "^1.1.0",
    "@angular/animations": "~9.0.0",
    "@angular/cdk": "^9.1.0",
    "@angular/common": "~9.0.0",
    "@angular/compiler": "~9.0.0",
    "@angular/core": "~9.0.2",
    "@angular/fire": "^5.4.2",
    "@angular/forms": "~9.0.0",
    "@angular/platform-browser": "~9.0.0",
    "@angular/platform-browser-dynamic": "~9.0.0",
    "@angular/router": "~9.0.0",
    "@auth0/angular-jwt": "^4.1.2",
    "@aws-amplify/ui-angular": "^0.2.4",
    "@glidejs/glide": "^3.4.1",
    "@ng-select/ng-select": "^3.7.0",
    "@ngx-translate/core": "^11.0.1",
    "@stripe/stripe-js": "^1.11.0",
    "@swimlane/ngx-datatable": "^16.0.3",
    "angular-archwizard": "^5.0.0",
    "angular-calendar": "^0.28.2",
    "angular-svg-round-progressbar": "^3.0.1",
    "angular2-hotkeys": "^2.1.5",
    "angular2-notifications": "^3.0.0",
    "aws-amplify": "^3.0.10",
    "buffer": "^5.6.0",
    "chart.js": "^2.9.3",
    "date-fns": "^2.8.0",
    "firebase": "^7.8.1",
    "intl-tel-input": "^14.1.0",
    "ng2-nouislider": "^1.8.2",
    "ngx-bootstrap": "^5.3.2",
    "ngx-contextmenu": "^5.3.0",
    "ngx-cookie-service": "^3.0.4",
    "ngx-dropzone": "^2.2.2",
    "ngx-dropzone-wrapper": "^8.0.0",
    "ngx-ellipsis": "^2.1.2",
    "ngx-lightbox": "^2.1.1",
    "ngx-perfect-scrollbar": "^8.0.0",
    "ngx-quill": "^7.3.11",
    "ngx-sortablejs": "^3.1.3",
    "nouislider": "^14.1.1",
    "quill": "^1.3.7",
    "rxjs": "~6.5.4",
    "sortablejs": "^1.9.0",
    "tslib": "^1.10.0",
    "video.js": "^7.6.6",
    "yamapng": "^2.0.4",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.900.1",
    "@angular/cli": "~9.0.3",
    "@angular/compiler-cli": "~9.0.0",
    "@angular/language-service": "~9.0.0",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "ng-swagger-gen": "^2.3.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "^3.8.3"
  }
}

我将 typescript 升级到 "typescript": "^3.8.3" 但仍然有同样的问题

截至撰写本文时,yamapng 的最新版本已有两年历史,并且是为与 @angular/common 版本 7 一起使用而编写的。但是您使用的是 运行ning 版本 9。在过去,这无关紧要,但您最近可能更新到 npm@7,它现在标记了这些问题。 (angular-svg-round-progressbarzone.js 也有类似的问题。)

你有很多选择:

  • 按照错误消息中的建议使用 --force 标志。
  • 更好的选择是使用 --legacy-peer-deps 选项。
  • 您可以降级到 npm 版本 6。
  • 寻找 yamapng 的替代品或要求维护者 update/publish 一个新版本。
  • ...以及许多其他开始变得杂草丛生的选项。例如,您可以只对一个命令使用 npx 到 运行 npm 版本 6。如果您确信它可以与不同版本的对等依赖项一起使用,或者修补包版本要求。