Updating to the latest Angular CLI
The Angular team releases a major new version every six months. By the moment I am composing these lines, we are waiting for v9 (to read more about the release cycles: https://angular.io/guide/releases). So its a necessity to keep the global @angular/CLI version in your computer up-to-date, before starting a new project.
In this article, we upgrade the CLI version on your computer (with the assumption you are using a Mac OS).
First step: Check the latest published CLI version.
npm view @angular/cli@latest
The console output is as follows (It is the version v8.3.13)
Second step: Which version am I using? Let’s check it together.
ng — version
As it seems from the console output, we are using a pretty old version of CLI. Let’s start the update process.
Third step: Verify cache! This command verifies the cache and runs garbage collection.
npm verify cache
Fourth step: We delete the cache (post npm v5 we need to use — force argument as well)
npm cache clean — force
Fifth step: Actually, the last step. Let’s install the latest version globally.
npm install -g @angular/cli@latest
Just don’t forget to check the latest version once again using the command written in the second step.
Hooray! We are all up-to-date with the @angular/CLI version.