我正在将 Angular 版本从 7 更新到 8。但出现对等依赖错误 [关闭]

Posted

技术标签:

【中文标题】我正在将 Angular 版本从 7 更新到 8。但出现对等依赖错误 [关闭]【英文标题】:I am updating Angular version from 7 to 8. But getting peer dependency error [closed] 【发布时间】:2020-09-19 12:15:18 【问题描述】:

我尝试使用 --force ,但没​​有用。

enter image description here

错误代码 -

    Package "@ng-bootstrap/ng-bootstrap" has an incompatible peer dependency to   "@angular/common" (requires "^7.0.0" (extended), would install "9.1.9").
 Package "@swimlane/ngx-charts" has an incompatible peer dependency to "@angular/animations" (requires "6.x" (extended), would install "9.1.9").
                  Package "codelyzer" has an incompatible peer dependency to "@angular/compiler" (requires ">=2.3.1 <8.0.0 || >7.0.0-beta <8.0.0" (extended), would install "9.1.9").
                  Package "@swimlane/ngx-charts" has an incompatible peer dependency to "@angular/platform-browser" (requires "6.x" (extended), would install "9.1.9").
                  Package "@swimlane/ngx-charts" has an incompatible peer dependency to "@angular/platform-browser-dynamic" (requires "^6.0.0" (extended), would install "9.1.9").
                  Package "@ng-bootstrap/ng-bootstrap" has an incompatible peer dependency to "@angular/forms" (requires "^7.0.0" (extended), would install "9.1.9").
                  Package "codelyzer" has an incompatible peer dependency to "@angular/core" (requires ">=2.3.1 <8.0.0 || >7.0.0-beta <8.0.0" (extended), would install "9.1.9").
                  Package "ngx-jsoneditor" has an incompatible peer dependency to "rxjs" (requires "^5.1.0", would install "6.5.5").
                  Package "ngx-jsoneditor" has an incompatible peer dependency to "zone.js" (requires "^0.8.4", would install "0.10.3").

【问题讨论】:

请注意,minimal reproducible example as text 必须在问题本身中。不接受截图。 屏幕图片更不用说了。 提示:使用 powershell 或 VS Code 的终端。它可以让您轻松复制文本。 【参考方案1】:

希望尝试下面的命令,它会被修复

ng update @angular/cli @angular/core

【讨论】:

我累了...但同样的问题@Dev216 尝试更新 --all --force 如果它不起作用,那么你运行下面的命令---- ng update @angular/cli @angular/core --force npm i @angular/cdk@8 @angular/compiler-cli@8 @angular/material@8 rxjs@8 --save @Owais 现在你的问题解决了吗?【参考方案2】:

尝试添加force flag

ng update @angular/core --force

【讨论】:

【参考方案3】:

您需要安装每个依赖项的兼容版本,这是该版本的代码

npm i --save dependencyName@version

【讨论】:

你能从上面的错误中发布一些例子吗...我是角度@Ess的新手 如果您已经安装了依赖项,请使用此ng update swimlane/ngx-charts@~8.2.12,否则以这种方式执行npm i swimlane/ngx-charts@^8.2.12 --save。如果您需要更多详细信息,请查看:checkMe

以上是关于我正在将 Angular 版本从 7 更新到 8。但出现对等依赖错误 [关闭]的主要内容,如果未能解决你的问题,请参考以下文章

对 @angular/core 的不兼容对等依赖:Angular 更新

角度更新 10.2 到 11

升级到 9.0 和 angular 7 后修复 angular-redux/store

存储库不干净。请在 Angular 8 中更新之前提交或存储任何更改

将解决方案从 .net framework 4 升级到更高版本。 4.7.2; 4.8.VS2013

无法将角度更新到版本 6