How To Update Angular CLI | Angular 8 CLI Upgrade
Upgrade Angular CLI to version 8 required some steps. To update Angular CLI to a new version, you must update both the global package and your project’s local package dependencies. You can perform a necessary update to the current stable release of the core framework and CLI by running ng update @angular/cli @angular/core. To update to the next beta or pre-release version, use the –next=true option.
To update from one major version to another, use the format ng update @angular/cli@^<major_version> @angular/core@^<major_version>.
We recommend that you always update to the latest patch version, as it contains fixes we released since the initial major release. For example, use the following command to take the most recent 8.x.x version and use that to update. ng update @angular/cli@^8 @angular/core@^8
How To Update Angular CLI To Version 8
Almost every 6-12 months, a new version of Angular is releasing. So to up to date with the latest version. You can find more about Angular CLI on its official documentation. You can see the features and upgrades of Angular 8.
You can check your current version of Angular CLI using the following command.
See the following output.
Right now, I have version 7. So, the next step is to upgrade the version of Angular CLI 7 to Angular CLI 8.
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
Then you need to hit the following command.
sudo npm cache clean
Now, install the Angular CLI using the following command.
sudo npm install -g @angular/cli@latest
See, I have installed the Angular 8 CLI.
Now, check your Angular CLI version using the following command.
After updating both the global and local package, clear the cache to avoid errors.
sudo npm cache verify npm cache clean (for older npm versions)
Update Angular Packages
If you have created an Angular project, then go inside that folder and type the following command.
ng update @angular/core
You can update RxJS using the ng update command.
ng update rxjs
ng new angular8demo cd angular8demo ng serve
sudo chown -R $USER:$GROUP ~/.npm sudo chown -R $USER:$GROUP ~/.config
Now, see the newly installed Angular 8 project.
You can see the updated Angular CLI to version 8 by creating the new Angular project.
Now, at the time of creating a new project, we got the following options, which are unique in Angular 8.
At the time of creating the Angular 8 project, we have not allowed creating the routing module. See the following project structure.
Finally, How To Update Angular CLI To Version 8 article is over.