将 Angular 应用程序从 6 升级到 10 更新后会产生很多错误

Posted

技术标签:

【中文标题】将 Angular 应用程序从 6 升级到 10 更新后会产生很多错误【英文标题】:Upgrade angular application from 6 to 10 produces lots of errors after update 【发布时间】:2020-11-21 00:57:09 【问题描述】:

请建议升级我的应用程序的最佳方法,并分享如何解决这样的对等依赖问题:-

Package "ngx-chips" has an incompatible peer dependency to "@angular/animations" (requires "^8.0.0" (extended), would install "10.0.7").
Package "@ng-bootstrap/ng-bootstrap" has a missing peer dependency of "@angular/localize" @ "^10.0.0".
Package "@ng-idle/core" has an incompatible peer dependency to "@angular/common" (requires "^9.0.0", would install "10.0.7")
Package "@ng-idle/core" has an incompatible peer dependency to "@angular/core" (requires "^9.0.0", would install "10.0.7")
Package "@ng-idle/core" has an incompatible peer dependency to "tslib" (requires "^1.10.0", would install "2.0.0")
Package "@ng-idle/keepalive" has an incompatible peer dependency to "@angular/common" (requires "^9.0.0", would install "10.0.7")
Package "@ng-idle/keepalive" has an incompatible peer dependency to "@angular/core" (requires "^9.0.0", would install "10.0.7")
Package "@ng-idle/keepalive" has an incompatible peer dependency to "tslib" (requires "^1.10.0", would install "2.0.0")
Package "ng2-file-drop" has an incompatible peer dependency to "core-js" (requires "^2.4.1", would install "3.6.5").
Package "@ng-select/ng-select" has an incompatible peer dependency to "@angular/common" (requires ">=9.0.0 <10.0.0", would install "10.0.7")
Package "@ng-select/ng-select" has an incompatible peer dependency to "@angular/core" (requires ">=9.0.0 <10.0.0", would install "10.0.7")
Package "@ng-select/ng-select" has an incompatible peer dependency to "@angular/forms" (requires ">=9.0.0 <10.0.0", would install "10.0.7")
Package "ng-recaptcha" has an incompatible peer dependency to "@angular/core" (requires "^6.0.0 || ^7.0.0 || ^8.0.0", would install "10.0.7")
Package "copy-webpack-plugin" has a missing peer dependency of "webpack" @ "^4.37.0 || ^5.0.0".
Package "ngx-mask" has an incompatible peer dependency to "@angular/common" (requires "^9.1.0", would install "10.0.7")
Package "ngx-mask" has an incompatible peer dependency to "@angular/core" (requires "^9.1.0", would install "

【问题讨论】:

欢迎来到 Stack Overflow!请访问help center,使用tour 了解内容和How to Ask。做一些研究,search for related topics on SO;如果您遇到困难,请发布您的尝试minimal reproducible example,并使用[&lt;&gt;] sn-p 编辑器记录输入和预期输出。 这种大步我认为最好创建一个新的 Angular 项目,再次添加所有必需的库(可能您获得更新版本的库并复制 .src。小心 rxjs 和httpClient 【参考方案1】:

在升级 Angular 项目时,不建议跨多个主要版本进行迁移。我强烈建议您按照此处使用更新指南的步骤操作:https://update.angular.io/。

【讨论】:

以上是关于将 Angular 应用程序从 6 升级到 10 更新后会产生很多错误的主要内容,如果未能解决你的问题,请参考以下文章

从 Angular 5 升级到 Angular 6,Bootstrap 按钮样式没有间距

ngrx/store@6.1.0 在升级到 Angular 7 时需要 @angular/core@^6.0.0 的对等体

Angular 6 中的 AuthHttp(从 Angular2 迁移到 Angular6)

想要将项目从 Angular v5 升级到 Angular v6

从 Angular 9 升级到 Angular 10 时遇到问题

升级 Angular 版本 5