从角度9升级到角度10的问题

时间:2020-06-25 20:02:23

标签: angular typescript npm package

我想更新我的角度项目,并使用了以下命令。

$ ng update @angular/core@9 @angular/cli@9
$ ng update @angular/core @angular/cli

但是在控制台中执行最后一个命令行后,它将引发以下错误。

Your global Angular CLI version (10.0.0) is greater than your local
version (9.1.9). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 40 dependencies.
Fetching dependency metadata from registry...
                  Package "@ng-select/ng-option-highlight" has an incompatible peer dependency to "@angular/core" (requires "^8.0.3" (extended), would install "10.0.0").
                  Package "@ng-select/ng-select" has an incompatible peer dependency to "@angular/forms" (requires ">=8.0.0 <9.0.0" 
(extended), would install "10.0.0").
                  Package "@ng-select/ng-option-highlight" has an incompatible peer dependency to "@angular/common" (requires "^8.0.3" (extended), would install "10.0.0").
× 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\jfhh\AppData\Local\Temp\ng-riDjkX\angular-errors.log" for further details.

1 个答案:

答案 0 :(得分:1)

可以通过添加后缀-force 来消除不兼容的对等项依赖关系错误 即使用以下命令

ng update @angular/core @angular/cli --force