How to check Angular CLI version?
Before updating Angular CLI version, we must know which Angular version we are running on our system. This can be done by a very simple command, enter the following command in your terminal.
ng --version
This command will show the installed Angular version in your system.
Update Angular CLI to latest version 7 | 8
Run the following command to install Angular CLI package globally in your machine.
Command for Mac Users
sudo npm uninstall -g angular-cli
For Windows Users
Windows powershell users use below command as an Administrator .
npm uninstall -g angular-cli
This command will will uninstall the angular-cli package globally from your machine.
Then don’t forget to clear the cache using the given below command.
sudo npm cache verify
Use the following command if your NPM version is less than 5.
npm cache clean
You are all set to install the Angular CLI again using the following command.
sudo npm install -g @angular/cli@latest
If any how you are seeing the old version, try the below command.
ng update @angular/cli
It’s time to check out your Angular CLI version, hit the below command.
ng --version
Once you are done updating both global and local packages, use the below command to clear the cache to get rid from the errors.
npm cache verify (recommended)
npm cache clean (use for older npm versions)
How to Update Angular Packages
If you are willing to update the core Angular packakges or dependencies, hit the below command in your terminal.
ng update @angular/core
How to update RxJS?
Use the below command to update RxJS via Angular CLI.
ng update rxjs