node.js 无法卸载 angular-cli
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43070441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot uninstall angular-cli
提问by Sandro Palmieri
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:
我已经多次尝试卸载我的 angular-cli 以更新它,但即使我按照 github 上提供的说明进行操作:
- npm uninstall -g @angular/cli
- npm cache clean
- npm install -g @angular/cli@latest
- npm uninstall -g @angular/cli
- npm 缓存清理
- npm install -g @angular/cli@latest
When I check using the command ng --version I still get the old version :
当我使用命令 ng --version 检查时,我仍然得到旧版本:
angular-cli: 1.0.0-beta.26
node: 7.7.1
os: darwin x64
How can i fix this issue? Thanks
我该如何解决这个问题?谢谢
采纳答案by Prabhat Maurya
If you are facing issue with angular/cli then use the following commands: npm uninstall -g angular-clito uninstall the angular/cli. npm cache cleanto clean your npm cache from app data folder under your username.
use npm cache verifyto verify your cache whether it is corrupted or not.
use npm cache verify --forceto clean your entire cache from your system.
如果您遇到 angular/cli 的问题,请使用以下命令:npm uninstall -g angular-cli卸载 angular/cli。npm cache clean从您的用户名下的应用程序数据文件夹中清除您的 npm 缓存。
用于npm cache verify验证您的缓存是否已损坏。
用于npm cache verify --force清除系统中的整个缓存。
Note:
You can also delete by the following the paths C:\Users\"Your_syste_User_name"\AppData\Roaming\npmand 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 visit github angular-cli update.
注意:
您也可以通过以下路径删除C:\Users\"Your_syste_User_name"\AppData\Roaming\npm,C:\Users\"Your_syste_User_name"\AppData\Roaming\npm-cache
然后使用以下命令在您的系统中全局安装最新的 angular/cli 版本。
要获取更多信息,请访问github angular-cli update。npm install -g @angular/cli@latest
回答by sib10
I have also faced the same issue in recent past for me I have do the following commands one by one in terminal.
最近我也遇到了同样的问题,我在终端中一一执行了以下命令。
sudo npm uninstall -g angular-cli
sudo npm cache clean
After this run
在这次运行之后
ng -v
If still get angular-cli version 1.0.0-beta.2x.x then run the following command
如果仍然得到 angular-cli 版本 1.0.0-beta.2x.x 然后运行以下命令
which ng
It will show the ng path. Go to the path and if it is linked with any file remove the same the link and actual ng file. In my case the link is in /usr/bin/ng and actual path of ng file is /lib/node_modules/@angular/cli/bin/ng.
它将显示 ng 路径。转到路径,如果它与任何文件链接,则删除相同的链接和实际的 ng 文件。在我的例子中,链接在 /usr/bin/ng 中,ng 文件的实际路径是 /lib/node_modules/@angular/cli/bin/ng。
sudo rm -rf /lib/node_modules/@angular/cli/bin/ng
sudo rm -rf /usr/bin/ng
Next you need to install @angular/cli using
接下来你需要使用安装@angular/cli
sudo npm install -g @angular/cli
Close all the terminal and run ng -v and you are on. May be it will help someone. Thanks :)
关闭所有终端并运行 ng -v 即可。可能它会帮助某人。谢谢 :)
回答by Farhad
https://github.com/angular/angular-cli#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.
如果您使用的是 Angular CLI 1.0.0-beta.28 或更低版本,则需要先卸载 angular-cli 包。
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 --version
ng --version
回答by ManeeshaIndrachapa
You are using the beta version of angular CLI you can do this way.
您正在使用 angular CLI 的测试版,您可以这样做。
npm uninstall -g @angular/cli
npm uninstall -g angular/cli
Then type,
然后输入,
npm cache clean
Then go to the AppData folder which is hidden in your users and go to roaming folder which is inside AppData then go to npm folder and delete angular files in there and also go to npm-cache folder and delete angular components in there.After that restart your PC and type
然后转到隐藏在用户中的 AppData 文件夹,然后转到 AppData 内的漫游文件夹,然后转到 npm 文件夹并删除其中的 angular 文件,然后转到 npm-cache 文件夹并删除其中的 angular 组件。然后重新启动你的电脑和类型
npm install -g @angular/cli@latest
This worked for me ??
这对我有用?
回答by Praym
This sometime happens when you had actually installed @angular/cli using yarn and not npm.
当您实际使用 yarn 而不是 npm 安装 @angular/cli 时,有时会发生这种情况。
You can verify this by looking in to yarn's global install folder.
您可以通过查看 yarn 的全局安装文件夹来验证这一点。
You can remove it from yarn using
您可以使用以下方法将其从纱线中删除
yarn global remove @angular/cli
yarn global remove @angular/cli
回答by Enayat
The following approach worked for me:
以下方法对我有用:
npm uninstall -g @angular/cli
and
和
npm cache verify
回答by Gustavo Topete
I found a solution, first, delete the ng file with
我找到了一个解决方案,首先,删除 ng 文件
sudo rm /usr/bin/ng
then install nvm(you need to restart your terminal to use nvm).
然后安装nvm(您需要重新启动终端才能使用 nvm)。
then install and use node 6 via nvm
然后通过 nvm 安装和使用节点 6
nvm install 6
nvm use 6
finally install angular cli
最后安装angular cli
npm install -g @angular/cli
this worked for me, I wanted to update to v1.0 stable from 1.0.28 beta, but couldn't uninstall the beta version (same situation that you desrcibed). Hope this works
这对我有用,我想从 1.0.28 测试版更新到 v1.0 稳定版,但无法卸载测试版(与您所描述的情况相同)。希望这有效
回答by Jimeh
I could not get the angular-cli to go away. I FINALLY figured out a way to find it on my windows machine. If you have Cygwin installed or you are running linux or mac you can run which ngand it will give you the directory the command is running from. In my case it was running from /c/Users/myuser/AppData/Roaming/npm/ng
我无法让 angular-cli 消失。我终于找到了在我的 Windows 机器上找到它的方法。如果您安装了 Cygwin 或者您正在运行 linux 或 mac,您可以运行which ng它,它将为您提供运行命令的目录。就我而言,它是从/c/Users/myuser/AppData/Roaming/npm/ng
回答by u7785227
I had the same problem. This doesn't work:
我有同样的问题。这不起作用:
npm uninstall -g angular/cli
npm cache clean
instead use:
而是使用:
npm uninstall -g @ angular/cli
回答by gaurav bhatt
While uninstalling Angular CLI I got the same message (as it had some permission issues):
在卸载 Angular CLI 时,我收到了相同的消息(因为它有一些权限问题):
Unable to delete .Staging folder
无法删除 .Staging 文件夹
I tried deleting the .stagingfolder 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.
我尝试.staging手动删除文件夹,但仍然出现相同的错误。我从管理员帐户登录并尝试再次手动删除暂存文件夹,但无济于事。
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.
然后我尝试从我的普通用户帐户创建项目并且它起作用了。

