将 Angular 6 升级到 8 时,我得到不兼容的对等依赖性(使用 ng update @angular/core)

When upgrading Angular 6to 8, I get incompatible peer dependency (using ng update @angular/core)

我正在使用此命令 ng update @angular/cli @angular/corefor 将 angular 版本从 6 更新到 8,但它显示了以下问题。

Package "@nguniversal/module-map-ngfactory-loader" has an incompatible peer dependency to "@angular/core" (requires ">=7.0.0-rc.0 <8.0.0||>=6.0.0-rc.0 <7.0.0", would install "8.2.5").
Package "@nguniversal/module-map-ngfactory-loader" has an incompatible peer dependency to "@angular/common" (requires ">=7.0.0-rc.0 <8.0.0||>=6.0.0-rc.0 <7.0.0", would install "8.2.5").
Package "@nguniversal/module-map-ngfactory-loader" has an incompatible peer dependency to "@angular/platform-server" (requires ">=7.0.0-rc.0 <8.0.0||>=6.0.0-rc.0 <7.0.0", would install "8.2.5").

发现不兼容的对等依赖项。见上文。

首先,从上一个开始一个一个地检查依赖关系,并使用下面的代码作为例子:

npm uninstall @angular/http

然后再次使用:

ng update @angular/cli @angular/core

现在您必须检查您的依赖项是什么,然后一一删除,最后,您将看到您的代码将被更新。

然后从上一个依赖项开始,您必须安装新版本的依赖项。

从 Angular 8.2 升级到 10 时,我收到了类似的错误。 运行:

npm uninstall @nguniversal/module-map-ngfactory-loader

然后 ng update 对我有用。