Site Overlay

How to update/Upgrade Angular 8 to Angular 9 by CLI ng update?

Share : Answer for How to update/Upgrade Angular 8 to Angular 9 by CLI ng update?

We first need to check the installed Angular CLI version and next update it to the latest Angular 9 version.
It's recommended that you first update to the latest minor release of Angular 8 before updating to v9.

 

Let's now see the update procedure step by step with an example.

Checking the Version of Angular CLI
Let's get started by checking the version of Angular CLI installed on our system. Head to your command-line interface and run:

$ ng --version


The ng --version command displays the information about the installed Angular CLI version and the versions of the Angular packages:

Angular CLI: 8.3.19
Node: 10.16.3
OS: win32 ia32
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.803.19
@angular-devkit/core         8.3.19
@angular-devkit/schematics   8.3.19
@schematics/angular          8.3.19
@schematics/update           0.803.19
rxjs                         6.4.0

We have @angular/cli v8.3.19 installed, now let's update it to the latest Angular 9 ?
Updating the Version of Angular CLI to Angular 9
To update the Angular CLI to the latest version 9,

 

If you dont't have Angular v8.3.19 installed you first need to update to it using:

$ npm install --no-save @angular/cli@^8.3.19

Next, you can update to Angular 9:

 $ ng update @angular/cli @angular/core 

 
Updating the Global Angular CLI Version
After updating your project, you also need to update the global Angular CLI version:

$ npm uninstall -g angular-cli

$ npm cache verify

$ npm install -g @angular/cli@latest

 

This is the output of ng v:

Angular CLI: 9.0.2
Node: 12.14.0
OS: linux x64

Angular:
...
Ivy Workspace:

Package Version
------------------------------------------------------
@angular-devkit/architect 0.900.2
@angular-devkit/core 9.0.2
@angular-devkit/schematics 9.0.2
@schematics/angular 9.0.2
@schematics/update 0.900.2
rxjs 6.5.3