无法卸载 Angular CLI 版本 [英] Can't uninstall Angular CLI version

查看:43
本文介绍了无法卸载 Angular CLI 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用最新的 CLI 在 Angular6 中创建一个新项目,但一直无法更新.为了解决这个问题,我一直在尝试删除 Angular CLI 并重新开始,但即使这样也行不通!

从一个随机文件夹(里面没有项目),如果我运行 ng -v 我得到

Angular CLI:1.5.4节点:9.4.0操作系统:达尔文 x64角度:...

我很容易地尝试运行以下命令;

npm uninstall -g angular-clinpm uninstall --save-dev angular-clinpm uninstall -g @angular/clinpm 缓存验证

然后是另一个 ng -v,我希望它会抱怨未找到 ng,而是显示相同的内容!

Angular CLI:1.5.4节点:9.4.0操作系统:达尔文 x64角度:...

我认为这可能与我使用 NVM 管理我的 Node 版本有关,但我找不到任何东西.

我也试过 npm install -g @angular/cli@latest 以上所有内容,但是当我检查我的 ng 版本时,它仍然显示相同的 1.5.4 而不是最新版本.

一些信息;

  1. 我什至不在项目目录中,所以没有 node_modules,一切都是全局的 -g
  2. 我使用的是 OSX 并使用 NVM 来管理我的 Node 版本,因此我运行的是 Node 9.4.0

@Everett 指出了删除任何本地引用的建议.我发现 /Users/joshua/.nvm/versions/node 存储额外的 node_modules 目录.我的问题仍然存在...

/Users/joshua/.nvm/versions/node/**v9.4.0**/lib/node_modules 的文件夹中,我没有看到任何对 angular 的引用;然而……

/Users/joshua/.nvm/versions/node/**v6.11.5**/lib/node_modules 我看到文件夹 @angular/cli

我的想法是,如果我使用 node nvm 版本 v9.4.0,我就是,它将使用该节点的 angular 版本.不幸的是,情况似乎并非如此.我很犹豫要不要从我的其他目录中删除 @angular refs,因为我正处于其他项目的中间,现在不想破坏我的环境,尽管我确信完整的 Node 和 NVM 删除会解决我的问题.

解决方案

我安装了 6.0.1 版.您执行的卸载步骤对我也不起作用.

因此,进入漫游文件夹并找到 npm 并手动删除 angular >> angular-cli

Angular 对我来说位于这条路径上:

C:\Users\{me}\AppData\Roaming\npm\node_modules

删除angular文件夹和/或angualr-cli文件夹

旧文件结构似乎与现在不同.

然后我使用以下方法重新安装:

npm install -g @angular/cli@latest

现在开始:

Angular CLI:6.0.3节点:8.11.1操作系统:win32 x64角度:...

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!

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

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

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.

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.

Some info;

  1. I'm not even in a project directory so there's no node_modules and everything is global -g
  2. I'm on OSX and using NVM to manage my Node versions, from the context of this I'm running node 9.4.0

@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...

In the folder for /Users/joshua/.nvm/versions/node/**v9.4.0**/lib/node_modules I do not see any references to angular; however...

In /Users/joshua/.nvm/versions/node/**v6.11.5**/lib/node_modules I see folder @angular/cli

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.

解决方案

I have version 6.0.1 installed. The steps you went through to uninstall did not work for me too.

So, go into you roaming folder and find npm and manually delete angular >> angular-cli

Angular was located at this path for me:

C:\Users\{me}\AppData\Roaming\npm\node_modules

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

and am now on:

Angular CLI: 6.0.3
Node: 8.11.1
OS: win32 x64
Angular:
...

这篇关于无法卸载 Angular CLI 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆