How to Uninstall Angular Cli
In this post we are going to see how to uninstall angular cli completely from your system.
Below is the command to uninstall angular cli globally.
Uninstall angular cli globally / Uninstall angular totally
npm uninstall -g @angular/cli
-g denotes that npm will remove angular cli from your system completely.
Clear Npm Cache
You can also clear cache files generated by the node package manager (npm). These files are generated for the temporary usage of libraries to work properly.
There will be no such harm by deleting these files but it should be cleaned by the node package manager (npm) itself.
To delete these file the node package manager provides a command which is below
npm cache clean
Clear Npm Cache Forcefully
If the above command doesn't work you can try using the --force flag with it to force delete the cache files
npm cache clean --force
Now check the below folder in your system to make sure that all folder regarding angular has been removed from your system. Remove if any folder with name @angular exists inside node_modules.
Type your PC's username in place of "UserName".
Check Angular Version
You can now use below npm command to check the angular version
If angular cli is uninstalled from your system it will show a message like below:
'ng' is not recognized as an internal or external command,
operable program or batch file.
Unable to uninstall angular cli
If you are unable to uninstall angular cli even after doing the steps mentioned try using sudo if you are a Linux user or check which package manger you used to install the angular cli. If you used npm which is node package manager the above mentioned steps should work, If you have installed angular cli using yarn use below.
Uninstall angular cli in Linux
If you are a Linux user try this command to uninstall angular cli.
sudo npm uninstall -g angular-cli
sudo npm cache clean
If you are unable to uninstall angular cli in Linux even using the command with sudo try this
sudo rm -rf /lib/node_modules/@angular/cli/bin/ng
sudo rm -rf /usr/bin/ng
Uninstall angular cli using yarn
To uninstall angular cli using yarn use this command
yarn global remove @angular/cli
Hope you find this post useful.