无法卸载Angular CLI版本 [英] Can't uninstall Angular CLI version
问题描述
我一直在尝试使用最新的CLI在Angular6中创建一个新项目,但是无法更新.为了解决这个问题,我一直只是尝试删除Angular CLI并重新开始,但那还是行不通!
I have been trying to create a new project in Angular6 using the latest CLI, but have been unable to update. In an attempt to resolve, I have been simply trying to remove Angular CLI and start over but even that's not working!
从随机文件夹(其中没有项目)中,如果我运行ng -v
,我会得到
From a random folder (without a project in it), if I run ng -v
I get
Angular CLI: 1.5.4
Node: 9.4.0
OS: darwin x64
Angular:
...
那么容易,我尝试运行以下命令;
So easily enough I try to run the following commands;
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
npm uninstall -g @angular/cli
npm cache verify
然后是另一个ng -v
,我希望它抱怨找不到ng,而是显示相同的内容!
Then another ng -v
, which I would expect it to complain that ng was not found, instead shows the same thing!
Angular CLI: 1.5.4
Node: 9.4.0
OS: darwin x64
Angular:
...
我当时以为这可能与我使用NVM管理Node版本有关,但是我什么都找不到.
I was thinking this could be related to the fact that I use NVM to manage my Node version, but I haven't been able to find anything.
在所有上述情况下,我也尝试过npm install -g @angular/cli@latest
,但是当我检查ng版本时,它仍然显示相同的1.5.4,而不是最新版本.
I have also tried npm install -g @angular/cli@latest
after all the above, but when I check my ng version it still shows the same 1.5.4 instead of the latest version.
一些信息;
- 我什至不在项目目录中,所以没有node_modules,并且所有内容都是全局的-g
- 我正在OSX上并使用NVM来管理我的Node版本,就此而言,我正在运行节点9.4.0
@Everett指出了删除任何本地引用的建议.我发现/Users/joshua/.nvm/versions/node
存储了额外的node_modules目录.我的问题仍然存在...
@Everett pointed out a suggestion to delete any local references. I found that /Users/joshua/.nvm/versions/node
stores extra node_modules directories. My problem persists though...
在/Users/joshua/.nvm/versions/node/**v9.4.0**/lib/node_modules
的文件夹中,我看不到任何有关angular的引用;但是...
In the folder for /Users/joshua/.nvm/versions/node/**v9.4.0**/lib/node_modules
I do not see any references to angular; however...
在/Users/joshua/.nvm/versions/node/**v6.11.5**/lib/node_modules
中,我看到了文件夹@angular/cli
In /Users/joshua/.nvm/versions/node/**v6.11.5**/lib/node_modules
I see folder @angular/cli
我在这里的想法是,如果我使用的是节点nvm v9.4.0版本,那将是使用该节点的angular版本.不幸的是,事实并非如此.我犹豫要从其他目录中删除@angular引用,因为我正处于其他项目的中间,并且现在不想破坏我的环境,尽管我确定完全删除Node和NVM可以解决我的问题.
My thought here would be that if I were using node nvm version v9.4.0, which I am, is that it would be using that node's version of angular. Unfortunately this doesn't seem to be the case. I am hesitant to delete @angular refs from my other directories as I'm in the middle of other projects and don't want to break my environment right now, though I'm sure a full Node and NVM delete would resolve my issue.
推荐答案
我安装了6.0.1版.您完成的卸载步骤对我也不起作用.
I have version 6.0.1 installed. The steps you went through to uninstall did not work for me too.
因此,进入漫游文件夹并找到npm并手动删除angular >> angular-cli
So, go into you roaming folder and find npm and manually delete angular >> angular-cli
Angular对我来说位于这条路径上
Angular was located at this path for me:
C:\Users\{me}\AppData\Roaming\npm\node_modules
删除角度文件夹和/或angualr-cli文件夹
Delete the angular folder and/or the angualr-cli folder
似乎旧文件结构与今天的文件结构不同.
It seems like the old file structure is different from what it is today.
然后我使用以下方法重新安装:
I then reinstalled using:
npm install -g @angular/cli@latest
现在打开:
Angular CLI: 6.0.3
Node: 8.11.1
OS: win32 x64
Angular:
...
这篇关于无法卸载Angular CLI版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!