gpt4 book ai didi

angular - 更新到 Angular 9 失败

转载 作者:行者123 更新时间:2023-12-01 21:47:02 28 4
gpt4 key购买 nike

我在我的项目中使用 Angular 8,并想升级到 Angular 9。

我关注 upgrade guide当我运行命令时:ng更新@angular/core @angular/cli,

我收到一条错误消息:

An unhandled exception occurred: 403 Forbidden - GET https://registry.npmjs.org/@angular%2fcli

更新:403 错误消失了,但现在我收到以下错误:

Package "@angular/core" has a missing peer dependency of "tslib" @ "^1.10.0".
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.0.1").
Package "@angular/compiler-cli" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/animations" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/forms" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/common" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-server" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/compiler" has a missing peer dependency of "tslib" @ "^1.10.0".
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.0.1").
Package "@angular/service-worker" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/router" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-browser-dynamic" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-browser" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "7.0.4" (extended), would install "9.0.1").

已解决:我已经将 tslib 添加到 package.json

最佳答案

遇到了同样的问题。

能够使用以下方法从 Angular 7 成功更新到 8:

ng update @angular/cli@8 @angular/core@8

但是,尝试使用以下方法从 Angular 8 更新到 9:

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

给我这个错误:

Package "@angular/compiler-cli" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/animations" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/common" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/compiler" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/core" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/forms" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-browser" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-server" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/router" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/service-worker" has a missing peer dependency of "tslib" @ "^1.10.0".

我通过将建议版本的 tslib 添加到 package.json 中的 devDependencies 解决了这个问题:

"devDependencies": {
"tslib": "^1.10.0",
...
}

关于angular - 更新到 Angular 9 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60261412/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com