LoginSignup
7
6

More than 3 years have passed since last update.

ng updateでAngular7から8にアップデート!

Last updated at Posted at 2019-06-03

Angular8.0が公開されましたね。

Angular7から8にアップデートしました。
実行履歴付きです。

環境

Angular CLI: 7.2.4
Node: 10.15.3
OS: win32 x64
Angular: 7.2.15
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.12.4
@angular-devkit/build-angular      0.12.4
@angular-devkit/build-optimizer    0.12.4
@angular-devkit/build-webpack      0.12.4
@angular-devkit/core               7.2.4
@angular-devkit/schematics         7.2.4
@angular/cdk                       7.3.7
@angular/cli                       7.2.4
@angular/flex-layout               7.0.0-beta.24
@angular/material                  7.3.7
@angular/material-moment-adapter   7.3.7
@ngtools/webpack                   7.2.4
@schematics/angular                7.2.4
@schematics/update                 0.12.4
rxjs                               6.3.3
typescript                         3.2.4
webpack                            4.28.4

ng updateコマンドを叩いてみる

ng updateコマンドを実行すると、package.jsonを解析し、更新可能なパッケージを示してくれます。

    We analyzed your package.json, there are some packages to update:

      Name                               Version                  Command to update
     --------------------------------------------------------------------------------
      @angular/cdk                       7.3.7 -> 8.0.0           ng update @angular/cdk
      @angular/cli                       7.2.4 -> 8.0.1           ng update @angular/cli
      @angular/core                      7.2.15 -> 8.0.0          ng update @angular/core
      @angular/material                  7.3.7 -> 8.0.0           ng update @angular/material
      rxjs                               6.3.3 -> 6.5.2           ng update rxjs


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

ng update --allしなさいと書いてあるのでそうしてみます。

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.4 <3.5", would install "3.5.1")
                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.1 < 3.5", would install "3.5.1")
                  Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.4 <3.5", would install "3.5.1").
Incompatible peer dependencies found. See above.

TypeScriptのバージョン依存の警告が出てきました。
メッセージ通り、TypeScript3.5をインストールしてはいけません!
…TypeScript3.5はサポートしていないので上げてはいけません。

なので、まとめてアップデートするのはあきらめて、ng update @angular/cli @angular/coreを実行します。

    Updating package.json with dependency @angular/language-service @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/animations @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/common @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/compiler-cli @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/compiler @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/core @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/forms @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/cli @ "8.0.1" (was "7.2.4")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/platform-browser @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency @angular/router @ "8.0.0" (was "7.2.15")...
    Updating package.json with dependency zone.js @ "0.9.1" (was "0.8.29")...
    Updating package.json with dependency @angular-devkit/build-angular @ "0.800.1" (was "0.12.4")...
    Updating package.json with dependency rxjs @ "6.5.2" (was "6.3.3")...
    Updating package.json with dependency typescript @ "3.4.5" (was "3.2.4")...
UPDATE package.json (1968 bytes)

> @angular/cli@8.0.1 postinstall C:\Users\user\Documents\develop\project\node_modules\@angular\cli
> node ./bin/postinstall/script.js

? Would you like to share anonymous usage data with the Angular Team at Google under
Google’s Privacy Policy at https://policies.google.com/privacy? For more details and
how to change this setting, see http://angular.io/analytics. (y/N)

統計情報を取得するか聞かれますのでお好きなほうを選ばないと先に進みません。

Thank you for sharing anonymous usage data. If you change your mind, the following
command will disable this feature entirely:

    ng analytics off

npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.3.1 requires a peer of popper.js@^1.14.7 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@4.5.0 requires a peer of @angular/compiler@>=2.3.1 <8.0.0 || >7.0.0-beta <8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@4.5.0 requires a peer of @angular/core@>=2.3.1 <8.0.0 || >7.0.0-beta <8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN firebase-functions@2.3.1 requires a peer of firebase-admin@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular-devkit/build-angular@0.800.1 requires a peer of typescript@>=3.1 < 3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler-cli@8.0.0 requires a peer of typescript@>=3.4 <3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/webpack@8.0.1 requires a peer of typescript@>=3.4 < 3.5 but none is installed. You must install peer dependencies yourself.

added 54 packages from 38 contributors, removed 141 packages, updated 101 packages, moved 17 packages and audited 22379 packages in 193.048s
found 0 vulnerabilities

    ** Executing migrations for package '@angular/cli' **
DELETE src/browserslist
CREATE browserslist (388 bytes)
UPDATE tslint.json (1849 bytes)
UPDATE package.json (1969 bytes)
UPDATE src/polyfills.ts (2838 bytes)
UPDATE tsconfig.json (538 bytes)
UPDATE src/tsconfig.app.json (166 bytes)
UPDATE src/tsconfig.spec.json (256 bytes)
UPDATE src/app/app-routing.module.ts (907 bytes)
npm WARN @angular-devkit/build-angular@0.800.1 requires a peer of typescript@>=3.1 < 3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler-cli@8.0.0 requires a peer of typescript@>=3.4 <3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/webpack@8.0.1 requires a peer of typescript@>=3.4 < 3.5 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.3.1 requires a peer of popper.js@^1.14.7 but none is installed. You must install peer dependencies yourself.
npm WARN firebase-functions@2.3.1 requires a peer of firebase-admin@^7.0.0 but none is installed. You must install peer dependencies yourself.

added 4 packages from 7 contributors, updated 1 package and audited 22385 packages in 7.953s
found 0 vulnerabilities

    ** Executing migrations for package '@angular/core' **
            ------ Static Query Migration ------
            With Angular version 8, developers need to
            explicitly specify the timing of ViewChild and
            ContentChild queries. Read more about this here:
            https://v8.angular.io/guide/static-query-migration
            ------------------------------------------------

アップデート完了!
お疲れさまでした。

参考

Angularアップデートガイド
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.3", would install "3.4.5"). · Issue #14561 · angular/angular-cli

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6