繁体   English   中英

错误:迁移失败:发现不兼容的对等依赖项(将 Angular 12 升级到 13 时)

[英]Error: Migration failed: Incompatible peer dependencies found (when upgrading Angular 12 to 13)

我想在我的项目中更新 Angular 版本12 -> 13 ,并且我使用Angular 更新指南来执行此操作,并且已经在使用第一个命令之后,即调用命令后: ng update @angular/core@13 @angular/cli@13在控制台中我收到此消息(按照上述命令):

The installed Angular CLI version is outdated.                            
Installing a temporary Angular CLI versioned 13.3.9 to perform the update.
√ Packages successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 61 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular-eslint/builder" has an incompatible peer dependency to "@angular/cli" (requires ">= 11.2.0 < 12.0.0", would install "13.3.9").
                  Package "@angular-material-components/datetime-picker" has an incompatible peer dependency to "@angular/common" (requires "^11.1.0" (extended), would install "13.3.11").
                  Package "@angular-eslint/eslint-plugin" has an incompatible peer dependency to "@angular/compiler" (requires ">= 11.2.0 < 12.0.0" (extended), would install "13.3.11").  
                  Package "@angular-material-components/datetime-picker" has an incompatible peer dependency to "@angular/core" (requires "^11.1.0" (extended), would install "13.3.11").  
                  Package "@angular-material-components/datetime-picker" has an incompatible peer dependency to "@angular/forms" (requires "^11.1.0" (extended), would install "13.3.11").           
                  Package "@angular-material-components/datetime-picker" has an incompatible peer dependency to "@angular/platform-browser" (requires "^11.1.0" (extended), would install "13.3.11").
× 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.

不知道问题是不是有些库使用 Angular 11 和版本 13 不再兼容。 我该如何解决这个问题?

我还上传了package.json依赖文件:

{
  "name": "angular",
  "version": "1.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-material-components/datetime-picker": "^5.1.0",
    "@angular-material-components/moment-adapter": "^5.0.0",
    "@angular/animations": "^12.0.2",
    "@angular/cdk": "^12.0.2",
    "@angular/common": "~12.0.2",
    "@angular/compiler": "~12.0.2",
    "@angular/core": "~12.0.2",
    "@angular/forms": "~12.0.2",
    "@angular/material": "^12.0.2",
    "@angular/platform-browser": "~12.0.2",
    "@angular/platform-browser-dynamic": "~12.0.2",
    "@angular/router": "~12.0.2",
    "chart.js": "^2.9.4",
    "jquery": "^3.6.0",
    "jspdf": "^2.3.1",
    "jspdf-autotable": "^3.5.14",
    "mat-table-exporter": "^10.2.3",
    "materialize-css": "^1.0.0",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.33",
    "ng2-charts": "^2.4.2",
    "ngx-file-drop": "^11.1.0",
    "ngx-logger": "^4.2.1",
    "ngx-material-timepicker": "^5.5.3",
    "ngx-quill": "^13.2.0",
    "ngx-spinner": "^11.0.1",
    "ngx-toastr": "^13.2.1",
    "quill": "^1.3.7",
    "quill-delta-to-html": "^0.12.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~12.0.2",
    "@angular-eslint/builder": "^4.0.0",
    "@angular-eslint/eslint-plugin": "^4.0.0",
    "@angular-eslint/eslint-plugin-template": "^4.0.0",
    "@angular-eslint/schematics": "12.0.0",
    "@angular-eslint/template-parser": "^4.0.0",
    "@angular/cli": "~12.0.2",
    "@angular/compiler-cli": "~12.0.2",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "codelyzer": "^6.0.0",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "latest",
    "eslint-plugin-jsdoc": "latest",
    "eslint-plugin-prefer-arrow": "latest",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "schematics-scss-migrate": "^1.3.13",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.2.4"
  }
}

这里的问题是,提到的包依赖于特定的 angular 版本,例如,对于您的日期时间选择器,您可以在此处找到依赖项 map: Z5E056C500A1C4B6A7110B50D807BADE/angular -componentspm/date-package/angular-comment.com。 拣货员

I suggest to have a clean git repository before updating (I think angular CLI is also requesting this) and check whether all packages have a version compatible with angular 13. If the answer to this question is yes, you can then update your angular packages by使用--force 之后,您可以将其他软件包更新到兼容版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM