To upgrade angular to its latest version, perform the following commands on a Terminal window:
npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@latest
You can also install a specific version, by typing the version number as follows:
npm install -g @angular/cli@<version-number>
Ref: https://www.npmjs.com/package/@angular/cli#updating-angular-cli
If you have installed Node with NVM, you can upgrade Node and Angular at the same time.
First, install a new version of Node:
nvm install node
Then install a new version of Angular:
npm install -g @angular/cli
With this method I have installed Angular 7 with Node v11.14.0, and Angular 8 with Node v12.4.0:
~/.nvm
└─ versions
└─ node
├─ v11.14.0
│ └─ lib
│ └─ node_modules
│ ├─ @angular (version 7)
│ └─ npm
└─ v12.4.0
└─ lib
└─ node_modules
├─ @angular (version 8)
└─ npm
Then using