Cannot uninstall angular-cli

2019-01-23 04:54发布

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

12条回答
聊天终结者
2楼-- · 2019-01-23 05:26

The following approach worked for me:

npm uninstall -g @angular/cli

and

npm cache verify
查看更多
我命由我不由天
3楼-- · 2019-01-23 05:28

You have to use (without @)

npm uninstall -g angular/cli

because

If you're using Angular CLI beta.28 or less, you need to uninstall angular-cli package. It should be done due to changing of package's name and scope from angular-cli to @angular/cli https://github.com/angular/angular-cli

查看更多
Bombasti
4楼-- · 2019-01-23 05:28

While uninstalling Angular CLI I got the same message (as it had some permission issues):

Unable to delete .Staging folder

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):

npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli.

Then I tried creating the project from my normal user account and it worked.

查看更多
我欲成王,谁敢阻挡
5楼-- · 2019-01-23 05:35

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

查看更多
混吃等死
6楼-- · 2019-01-23 05:40

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.

npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest

Then when it gets done successfully you may try:

ng -v

查看更多
我想做一个坏孩纸
7楼-- · 2019-01-23 05:40

Try to update via these steps found in the npm repo for the angular cli.

npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest

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

查看更多
登录 后发表回答