In this tutorial I will give you details on how you can upgrade Angular CLI 7 to Version 8.
Table of Contents
Steps to Upgrade Angular CLI
- Uninstall existing Angular CLI
- Clean Npm cache
- Install latest version of Angular CLI
To checkout your current version of Angular CLI, you can execute following command from your terminal or from command prompt if your on windows.
ng --version
It will display the existing version you have installed on your system:
So as you can see in the above screen I have Angular CLI Version 7 currently installed, so let’s upgrade it to version 8
So to update angular-cli packages installed globally first we need to uninstall them and then clear the cache and install latest angular cli.
1. Un-Install Existing Angular CLI
npm uninstall -g angular-cli
If you on Mac you need to prefix the above commands with sudo.
Also if you are getting issue running above commands on windows then Open Power-shell on windows in Administrator Mode.
2. Verify/Clean NPM cache
npm cache verify
OR
Use following command only if your using npm version less that or equal to 5
npm cache clean
In my case I have npm 6 so I can use npm cache verify command as showing below:
3. Install Latest version of Angular CLI
So after you have verify or clean cache depending on the npm version you use, next install latest version of angular CLI using below command:
npm install -g @angular/cli@latest
Now we have successfully installed latest version of Angular Cli, you can ensure that by using ng command showing below:
ng --version
Upgrade Existing Angular 7 Project to Angular 8
If you want to upgrade your existing Angular 7 project to Angular 8 then open up your terminal and execute following command.
Please note before executing following command you should upgrade you Angular CLI first as showing in the above steps.
ng update @angular/core
The above command will get you all the latest libraries of Angular
We are done, let me know if you get any issue while updating Angular CLI on your system using comment box below.
Also you can read about complete angular development setup for your windows, linux or mac operating system from this tutorial – Setting up Angular Development Environment