How to uninstall/upgrade Angular CLI?
Using following commands to uninstall :
npm uninstall -g @angular/cli
npm cache clean --force
To verify: ng --version /* You will get the error message, then u have uninstalled */
Using following commands to re-install :
npm install -g @angular/cli
Notes :
- Using --force for clean all the caches
- On Windows run this using administrator
- On Mac use sudo ($ sudo <command>
)
- If you are using
npm>5
you may need to use cache verify instead. ($ npm cache verify
)
None of the above solutions alone worked for me. On Windows 7 this worked:
Install Rapid Environment Editor and remove any entries for node, npm, angular-cli or @angular/cli
Uninstall node.js and reinstall. Run Rapid Environment Editor again and make sure node.js and npm are in your System or User path. Uninstall any existing ng versions with:
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
Delete the C:\Users\YOU\AppData\Roaming\npm\node_modules\@angular
folder.
Reboot, then, finally, run:
npm install -g @angular/cli
Then hold your breath and run ng -v. If you're lucky, you'll get some love. Hold your breath henceforward every time you run the ng command, because 'command not found' has magically reappeared for me several times after ng was running fine and I thought the problem was solved.