How To Globally Update to Latest Angular 9 Version?

Last Updated on by in Angular
In this tutorial we are going to get the answer for how to update Angular CLI to the latest version, the current latest Angular version is 9.How to Check Installed Angular CLI Version?

Let’s get started.

Following steps need to take, to update the Angular CLI to latest version 9.

First, update to the angular CLI to version 8 by running the following command.

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

Once, you are done updating to angular CLI 8, then update angular CLI to version 9.

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

The –next flag is only used for Angular 9 RC version. However, once the final version of Angular 9 is released. Then, we won’t need the --next flag.

Updating to Latest Angular CLI Version

To update the Angular CLI version globally in your development system, you require to follow the following steps.

First, we need to uninstall the current angular cli packages. Also, don’t forget to use the npm cache verify command. This command makes sure that there shouldn’t be any cache-related problem left.

npm uninstall -g angular-cli

npm cache clean or npm cache verify (if npm > 5)

Next, run the command to install the Angular CLI version:

npm install -g @angular/cli@latest

If you face any permission related issue then use the above command with `sudo` prefix. The sudo prefix mostly required in Linux and macOS systems, the sudo require the password and run without any problem.

sudo npm uninstall -g angular-cli

sudo npm cache clean or npm cache verify (if npm > 5)

sudo npm install -g @angular/cli@latest

Global Angular CLI version Greater than Local version

When we run `ng serve` we might get the warning if global CLI version is greater than our local Angular CLI version.

The local angular packages have more weight than the global angular packages. So, to get rid of this problem, we have to update the local Angular CLI packages.

How to Update Local Angular CLI version

Let’s update the local Angular CLI version. To update the local Angular CLI version of your local angular project.

You have to get into your project folder. Then, run the following commands from the root of your angular project.

rm -rf node_modules

npm uninstall --save-dev angular-cli

npm install --save-dev @angular/cli@latest

npm install