如何完全卸载Node.js,并从头开始重新安装(Mac OS X) [英] How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

查看:1330
本文介绍了如何完全卸载Node.js,并从头开始重新安装(Mac OS X)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在我安装brew节点和NVM安装v0.6.19之后,我的节点版本总是v0.6.1-pre。

My version of node is always v0.6.1-pre even after I install brew node and NVM install v0.6.19.

我的节点版本是:

node -v
v0.6.1-pre

NVM说这个(在我在一个bash终端首次安装节点版本之后):

NVM says this (after I install a version of node for the first time in one bash terminal):

nvm ls
v0.6.19
current:    v0.6.19

但是当我重新启动bash时,这就是我所看到的:

But when I restart bash, this is what I see:

nvm ls
v0.6.19
current:    v0.6.1-pre
default -> 0.6.19 (-> v0.6.19)

那么这个幻像节点0.6.1-预先版本,我怎么能摆脱它?我正在尝试通过NPM安装库,以便我可以处理项目。

So where is this phantom node 0.6.1-pre version and how can I get rid of it? I'm trying to install libraries via NPM so that I can work on a project.

我尝试使用BREW在NVM之前更新,使用brew update和brew安装节点。
我试过删除/ usr / local / include中的node目录以及我的/ usr / local / lib中的node和node_modules。
我尝试卸载npm并按照这些说明重新安装它。

I tried using BREW to update before NVM, using "brew update" and "brew install node". I've tried deleting the "node" directory in my /usr/local/include and the "node" and "node_modules" in my "/usr/local/lib". I've tried uninstalling npm and reinstalling it following these instructions.

所有这些都是因为我试图更新旧版本的节点以安装zipstream库。现在我的用户目录中有文件夹,节点版本STILL不是最新的,即使NVM说它使用的是0.6.19。

All of this because I was trying to update an older version of node to install the "zipstream" library. Now there's folders in my users directory, and the node version STILL isn't up to date, even though NVM says it's using 0.6.19.

理想情况下,我想卸载nodejs,npm和nvm,然后在我的系统上重新安装整个东西。

推荐答案

显然,有一个 / Users / myusername / local 文件夹,其中包含 include ,其中包含 node lib 节点 node_modules 。如何以及为什么创建它而不是在我的 / usr / local 文件夹中,我不知道。

Apparently, there was a /Users/myusername/local folder that contained a include with node and lib with node and node_modules. How and why this was created instead of in my /usr/local folder, I do not know.

正在删除这些本地引用修复了幻像v0.6.1-pre。如果有人有解释,我会选择正确答案。

Deleting these local references fixed the phantom v0.6.1-pre. If anyone has an explanation, I'll choose that as the correct answer.

编辑:

您可能还需要执行其他说明:

You may need to do the additional instructions as well:

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

相当于(与上述相同)......

which is the equivalent of (same as above)...

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp 

或(与上述相同)细分...

or (same as above) broken down...

至完全卸载node + npm将执行以下操作:

To completely uninstall node + npm is to do the following:


  1. 转到 / usr / local / lib 并删除任何节点 node_modules

  2. 转到 / usr / local / include 并删除任何节点 node_modules 目录

  3. 如果您使用 brew安装进行安装节点,然后在终端中运行 brew卸载节点

  4. 检查您的主目录中是否有本地 lib 包含文件夹,并从那里删除任何节点 node_modules

  5. go到 / usr / local / bin 并删除任何节点可执行文件

  1. go to /usr/local/lib and delete any node and node_modules
  2. go to /usr/local/include and delete any node and node_modules directory
  3. if you installed with brew install node, then run brew uninstall node in your terminal
  4. check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
  5. go to /usr/local/bin and delete any node executable

你可能还需要这样做:

sudo rm -rf /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node.1 /usr/local/lib/dtrace/node.d

此外,NVM修改 $ HOME / .bashrc中的PATH变量,必须手动还原

Additionally, NVM modifies the PATH variable in $HOME/.bashrc, which must be reverted manually.

然后下载 nvm 并按照说明安装节点。我相信最新版本的节点有 npm ,但您也可以重新安装。

Then download nvm and follow the instructions to install node. The latest versions of node come with npm, I believe, but you can also reinstall that as well.

这篇关于如何完全卸载Node.js,并从头开始重新安装(Mac OS X)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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