How to Update Angular CLI to Latest Version

To update Angular CLI to the latest version, use the format ng update @angular/cli@^<major_version> @angular/core@^<major_version> command.

You can check your current version of Angular CLI using the following command.

ng --version

To update the latest angular-cli package installed globally in your system, you need to run the following commands.

sudo npm uninstall -g angular-cli // For Mac

npm uninstall -g angular-cli // For Windows Open Powershell on Administrator Mode

Then we need to clear the cache using the following command.

sudo npm cache verify

Angular CLI update

Then you need to hit the following command.

sudo npm cache clean 

Install the Angular CLI using the following command.

sudo npm install -g @angular/cli@latest

It will install the updated angular cli version.

After updating both the global and local packages, clear the cache to avoid errors.

sudo npm cache verify

npm cache clean (for older npm versions)

Update Angular Packages

If you created an Angular project, go inside that folder and type the following command.

ng update @angular/core

Upgrading RxJS

You can update RxJS using the ng update command.

ng update rxjs

We are generating and serving an Angular project via a development server. Create and run a new project.

ng new angulardemo
cd angulardemo
ng serve

If you face any npm install: Unhandled rejection Error: EACCES: permission denied error, please try the following command.

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config

You can see the newly installed Angular project.

You can see the updated Angular CLI to version 13 by creating the new Angular project.

When creating a new project, we got the following options, which are unique in Angular 13.

When creating the Angular 13 project, we have not allowed to create the routing module. Instead, see the following project structure.

Angular 8 Project Structure

That is it for upgrading the guide to Angular CLI.

5 thoughts on “How to Update Angular CLI to Latest Version”

  1. Thanks I have been searching for this for a while. If you can add angular universal tutorial for angular 8 that will be benificial.

  2. Hi. It didn’t work for me. I had to resort to delete the global node_modules folder ($HOME/.node_modules) and install angular CLI from scratch.

  3. ********* Steps to update your Angular CLI ********** :-

    1. Open PowerShell in Admin Mode
    2. type – npm uninstall -g angular-cli
    3. type – npm cache verify
    4. type – npm cache clean –force
    5. type – npm install -g @angular/cli@latest

    **FOR Existing Project :

    Now go to visual studio code, open any project and type below commands :-

    1. npm install –save-dev @angular/cli@latest
    2. ng update @angular/cli
    3. ng update @angular/core
    4. ng update rxjs


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.