单版更新角度

发布于 2025-01-17 08:01:19 字数 3857 浏览 3 评论 0原文

我必须将 Angular 7.x 项目更新到 Angular 8.2.0,因此我在线阅读了 ng update

我的全局角度版本等于我的更新目标版本(8.2.0),但 ng update 强制我更新到最新版本。

Your global Angular CLI version (8.2.0) is greater than your local
version (7.3.5). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
    We analyzed your package.json, there are some packages to update:

      Name                                      Version                  Command to update
     ---------------------------------------------------------------------------------------
      @angular/cdk                              7.3.3 -> 13.3.1          ng update @angular/cdk
      @angular/cli                              7.3.5 -> 13.3.0          ng update @angular/cli
      @angular/core                             7.2.8 -> 13.3.0          ng update @angular/core
      @angular/core                             7.2.8 -> 7.2.16          ng update @angular/core
      @angular/fire                             5.1.1 -> 7.3.0           ng update @angular/fire
      @angular/material                         7.3.3 -> 13.3.1          ng update @angular/material
      @nguniversal/aspnetcore-engine            7.1.1 -> 8.2.6           ng update @nguniversal/aspnetcore-engine
      @nguniversal/express-engine               7.1.1 -> 13.1.0          ng update @nguniversal/express-engine
      @ngx-i18nsupport/tooling                  1.1.2 -> 8.0.3           ng update @ngx-i18nsupport/tooling
      ng-mocks                                  7.7.0 -> 13.3.0          ng update ng-mocks


    There might be additional packages that are outdated.
    Run "ng update --all" to try to update all at the same time.

有没有办法使用 ng update --all 来做到这一点?我是否必须使用 Angular 更新指南

我也尝试过 ng update @angular/cli --from="7.3.5" --to="8.2.0" 但它不起作用。

                  Package "@angular-devkit/build-ng-packagr" has an incompatible peer dependency to "ng-packagr" (requires "^2.2.0 || ^3.0.0 || ^4.0.0", would install "13.3.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 "13.3.0").
                  Package "ng-mocks" has an incompatible peer dependency to "@angular/forms" (requires ">=5.x <=7.x" (extended), would install "13.3.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 "13.3.0").
                  Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "7.2.8" (extended), would install "13.3.0").
                  Package "@ismaestro/ngx-example-library" has an incompatible peer dependency to "@angular/common" (requires "^6.0.0-rc.0 || ^6.0.0" (extended), would install "13.3.0").
                  Package "@angular/fire" has an incompatible peer dependency to "@angular/platform-browser-dynamic" (requires ">=6.0.0 <8" (extended), would install "13.3.0").
                  Package "@nguniversal/express-engine" has an incompatible peer dependency to "@angular/platform-server" (requires "^7.1.4" (extended), would install "13.3.0").
                  Package "tsickle" has an incompatible peer dependency to "typescript" (requires "~3.3.1", would install "4.6.3").
                  Package "@angular/fire" has an incompatible peer dependency to "zone.js" (requires "^0.8.0", would install "0.11.5").
                  Package "@angular/http" has an incompatible peer dependency to "rxjs" (requires "^6.0.0", would install "7.5.5").```

i have to update an angular 7.x project to angular 8.2.0, so i've read online of ng update.

I have a global angular version equal to my update target version (8.2.0) but ng update forces me to update to the latest version.

Your global Angular CLI version (8.2.0) is greater than your local
version (7.3.5). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
    We analyzed your package.json, there are some packages to update:

      Name                                      Version                  Command to update
     ---------------------------------------------------------------------------------------
      @angular/cdk                              7.3.3 -> 13.3.1          ng update @angular/cdk
      @angular/cli                              7.3.5 -> 13.3.0          ng update @angular/cli
      @angular/core                             7.2.8 -> 13.3.0          ng update @angular/core
      @angular/core                             7.2.8 -> 7.2.16          ng update @angular/core
      @angular/fire                             5.1.1 -> 7.3.0           ng update @angular/fire
      @angular/material                         7.3.3 -> 13.3.1          ng update @angular/material
      @nguniversal/aspnetcore-engine            7.1.1 -> 8.2.6           ng update @nguniversal/aspnetcore-engine
      @nguniversal/express-engine               7.1.1 -> 13.1.0          ng update @nguniversal/express-engine
      @ngx-i18nsupport/tooling                  1.1.2 -> 8.0.3           ng update @ngx-i18nsupport/tooling
      ng-mocks                                  7.7.0 -> 13.3.0          ng update ng-mocks


    There might be additional packages that are outdated.
    Run "ng update --all" to try to update all at the same time.

Is there a way to do this using ng update --all or not? Do I have to use Angular update guide?

I have also tried ng update @angular/cli --from="7.3.5" --to="8.2.0" but it does not work.

                  Package "@angular-devkit/build-ng-packagr" has an incompatible peer dependency to "ng-packagr" (requires "^2.2.0 || ^3.0.0 || ^4.0.0", would install "13.3.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 "13.3.0").
                  Package "ng-mocks" has an incompatible peer dependency to "@angular/forms" (requires ">=5.x <=7.x" (extended), would install "13.3.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 "13.3.0").
                  Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "7.2.8" (extended), would install "13.3.0").
                  Package "@ismaestro/ngx-example-library" has an incompatible peer dependency to "@angular/common" (requires "^6.0.0-rc.0 || ^6.0.0" (extended), would install "13.3.0").
                  Package "@angular/fire" has an incompatible peer dependency to "@angular/platform-browser-dynamic" (requires ">=6.0.0 <8" (extended), would install "13.3.0").
                  Package "@nguniversal/express-engine" has an incompatible peer dependency to "@angular/platform-server" (requires "^7.1.4" (extended), would install "13.3.0").
                  Package "tsickle" has an incompatible peer dependency to "typescript" (requires "~3.3.1", would install "4.6.3").
                  Package "@angular/fire" has an incompatible peer dependency to "zone.js" (requires "^0.8.0", would install "0.11.5").
                  Package "@angular/http" has an incompatible peer dependency to "rxjs" (requires "^6.0.0", would install "7.5.5").```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

送舟行 2025-01-24 08:01:19

这是因为当您执行 ng update 时,您并未定义特定版本。
您应该使用诸如 ng update @angular/core@10 @angular/cli@10 等之类的东西...

不建议在一次更新中从 Angular 7 升级到 Angular 13,相反,您应该这样做逐个版本,例如:

  • Angular 7 ->角度 8,
  • 角度 8 -> Angular 9.1

遵循此 Angular 更新指南,应该没问题,底部有每次更新前应执行的具体说明
https://update.angular.io/

That is because when you do ng update you are not defining a specific version.
You should use something like ng update @angular/core@10 @angular/cli@10 etc...

Its not recommended to go from Angular 7 to Angular 13 in a single update, instead you should go version by version like:

  • Angular 7 -> Angular 8,
  • Angular 8 -> Angular 9.1

Follow this Angular Update Guide and you should be fine, at the bottom you have specific instructions you should do before each update
https://update.angular.io/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文