【问题标题】:Getting error when upgrading from Angular 10 to 11从 Angular 10 升级到 11 时出错
【发布时间】:2021-07-13 18:30:07
【问题描述】:

我正在尝试从 Angular 10 升级到 11。当我运行以下命令时,出现错误。

ng 更新@angular/core@11 @angular/cli@11

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 44 dependencies.

Fetching dependency metadata from registry...

                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to 
"typescript" (requires "~4.0.0 || ~4.1.0", would install "4.3.5")

                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=4.0 <4.2", would install "4.3.5")

× 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\DEFAUL~1.DES\AppData\Local\Temp\ng-13szno\angular-errors.log" for further details.

我不确定错误是什么。我查看了 package.json 文件,我已经有了 typescript 4.3.5。

【问题讨论】:

  • 尝试运行ng update 并包含--force 参数。我这样做的经验很好。
  • @R.Richards 我在想,但在别处读到这不是最好的做法。无论如何,我继续尝试。之后出现了一些问题,但可能与使用 --force 标志无关。谢谢。

标签: angular typescript upgrade


【解决方案1】:

尝试在命令中添加--force 参数并忽略警告。

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

【讨论】:

  • 我想指出,虽然这个命令确实会更新所有库,但它可能会破坏项目依赖关系,但 --force 键有点危险,所以我建议不要使用它跨度>
猜你喜欢
  • 1970-01-01
  • 2019-10-26
  • 2021-05-02
  • 2020-10-16
  • 1970-01-01
  • 1970-01-01
  • 2020-12-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多