3

I try update Angular project from version 7.2.5 to 8 of the core framework and CLI by running ng update @angular/cli @angular/core in terminal.

Response from terminal was 'We analyzed your package.json and everything seems to be in order. Good work!'

My version list:

$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 7.3.9
Node: 11.14.0
OS: darwin x64
Angular: 7.2.15
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.13.9
@angular-devkit/build-angular      0.13.9
@angular-devkit/build-ng-packagr   0.13.9
@angular-devkit/build-optimizer    0.13.9
@angular-devkit/build-webpack      0.13.9
@angular-devkit/core               7.3.9
@angular-devkit/schematics         7.3.9
@angular/cdk                       7.3.7
@angular/cli                       7.3.9
@angular/material                  7.3.7
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.3.9
@schematics/angular                7.3.9 (cli-only)
@schematics/update                 0.13.9
ng-packagr                         5.2.0
rxjs                               6.5.2
typescript                         3.2.4
webpack                            4.29.0
ErikHer
  • 227
  • 2
  • 5
  • 12
  • According to https://angular.io/guide/releases#support-policy-and-schedule there is no stable 8.0 version yet, only a beta. – Hypenate May 27 '19 at 11:42

6 Answers6

7

As of today it is alread stable 8.0.0 :)

You might want to try to run ng update --all to update all packages in your package.json file. That might, however, not proceed if it discovers that some inter-dependencies are not met among other packages. In such a case you might want to also add --force option.

Alternatively, you can choose a more tailored approach and hand-pick packages to update (as suggested in answer by Veeraragavan), but you no longer need to add @next version, since all Angular package 8.0.0 versions are stable as of now.

Harijs Deksnis
  • 1,366
  • 1
  • 13
  • 24
4

As of today, Angular 8 is not a stable version.

But if you really wish to update non stable version use @next at the end of the package name.

ng update @angular/cli@next @angular/core@next

Veeraragavan
  • 343
  • 1
  • 8
2

The Angular team made upgrading much easier than before. You can get the commands that you need to run to update your project from an Angular version to another one by using the Angular Update Guide.

Head to that interactive guide and specify 7.1.4 as the current version and the target version which is v8.3.2 and click the Show me how to update button.

After specifying the versions, you'll get a warning saying We do not recommend moving across multiple major versions. Since we are moving from v7 to v8:

Angular 8 uses TypeScript 3.4, read more about errors that might arise from improved type checking.

Make sure you are using Node 10 or later.

In you command-line interface run the following command:

$ ng update

This will analyze the package.json file of your project and give you a list of packages to update with the required commands:

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

      Name                               Version                  Command to update
     --------------------------------------------------------------------------------
      @angular/cli                       7.1.4 -> 8.3.19          ng update @angular/cli
      @angular/core                      7.1.4 -> 8.2.14          ng update @angular/core
      rxjs                               6.3.3 -> 6.5.3           ng update rxjs


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

So, let's start by updating the core framework and the CLI to v8.2.14 and v8.3.19 respectively using the following command:

$ ng update @angular/cli @angular/core

This will update the core framework and CLI to Angular 8:

    Updating package.json with dependency @angular/compiler @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency @angular/language-service @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency @angular/forms @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency @angular/platform-browser @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency @angular/cli @ "8.3.19" (was "7.1.4")...
    Updating package.json with dependency @angular/animations @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency @angular/common @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency zone.js @ "0.9.1" (was "0.8.26")...
    Updating package.json with dependency rxjs @ "6.5.3" (was "6.3.3")...
    Updating package.json with dependency @angular/router @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency @angular/core @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency @angular/compiler-cli @ "8.2.14" (was "7.1.4")...
    Updating package.json with dependency typescript @ "3.5.3" (was "3.1.6")...

Note: On Windows I had to run npm install after ng update @angular/cli @angular/core to install the new versions of the dependencies.

Now, let's check the new version of Angular using the following command:

$ ng --version

This is the output of the command:

Angular CLI: 8.3.19
Node: 10.16.3
OS: win32 ia32
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.11.4
@angular-devkit/build-angular     0.11.4
@angular-devkit/build-optimizer   0.11.4
@angular-devkit/build-webpack     0.11.4
@angular-devkit/core              7.1.4
@angular-devkit/schematics        8.3.19
@angular/cli                      8.3.19
@ngtools/webpack                  7.1.4
@schematics/angular               8.3.19
@schematics/update                0.803.19
rxjs                              6.5.3
typescript                        3.5.3
webpack                           4.23.1

You can see that we have successfully updated Angular CLI to v8.3.19, Angular to v8.2.14 and different core packages. Even TypeScript is bumped to v3.5.3.

I got these instructions from this update guide and this official post

M--
  • 25,431
  • 8
  • 61
  • 93
Kaima Abbas
  • 93
  • 1
  • 1
  • 5
0

In addition to the other answers regarding the ng update command, please note that there are breaking changes between Angular versions 7 and 8 which would require attention.

In particular:

  • If you use the legacy HttpModule and the Http service, switch to HttpClientModule and the HttpClient service. HttpClient simplifies the default ergonomics (you don't need to map to JSON anymore) and now supports typed return values and interceptors. Read more on angular.io.
  • Make sure you are using Node 10 or later.

Angular describes this process in full detail in their Angular Update Guide.

Alex Walker
  • 2,337
  • 1
  • 17
  • 32
0

If you repeat

ng update @angular/cli @angular/core

It will upgrade to next step i.e. 8

Sunil Kumar
  • 6,112
  • 6
  • 36
  • 40
0

Update to version 8 of the core framework and CLI by running

ng update @angular/cli@8 @angular/core@8 in your terminal

Manoj Gupta
  • 456
  • 4
  • 9