I've tried several times to uninstall my angular-cli in order to update it but even if I follow the instructions provided on github:
- npm uninstall -g @angular/cli
- npm cache clean
- npm install -g @angular/cli@latest
When I check using the command ng --version I still get the old version :
angular-cli: 1.0.0-beta.26
node: 7.7.1
os: darwin x64
How can i fix this issue? Thanks
The following approach worked for me:
and
You have to use (without @)
because
While uninstalling Angular CLI I got the same message (as it had some permission issues):
I tried deleting the
.staging
folder manually, but still got the same error. I logged in from my administrator account and tried deleting the staging folder again manually, but to no avail.I tried this (run as Administrator):
Then I tried creating the project from my normal user account and it worked.
If you are facing issue with angular/cli then use the following commands-
npm uninstall -g angular-cli -To uninstall the angular/cli.
npm cache clean - It will clean your npm cache from app data folder under your username. use npm cache verify - It will verify your cache whether it is corrupted or not.
use npm cache verify --force -in order to clean your entire cache from your system.
Note- You can also delete by the following the path - C:\Users\"Your_syste_User_name"\AppData\Roaming\npm and C:\Users\"Your_syste_User_name"\AppData\Roaming\npm-cache.
Then use the following command to install latest angular/cli version globally in your system.
npm install -g @angular/cli@latest To get more information enter link description here
Updating Angular CLI
https://github.com/angular/angular-cli#updating-angular-cli
If you're using Angular CLI 1.0.0-beta.28 or less, you need to uninstall angular-cli package first.
Then when it gets done successfully you may try:
ng -v
Try to update via these steps found in the npm repo for the angular cli.
There is also an angular cli migration guide. One other option (more involved) is to start a new project and migrate over by copying and pasting certain files. This can be found here in the "moving into the cli" section of the angular-cli github