Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
476 views
in Technique[技术] by (71.8m points)

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

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

(我的节点版本始终是v0.6.1-pre,即使我安装了brew节点并且NVM也安装了v0.6.19。)

My node version is:

(我的节点版本是:)

node -v
v0.6.1-pre

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

(NVM这样说(我在一个bash终端中第一次安装了一个版本的节点之后):)

nvm ls
v0.6.19
current:    v0.6.19

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

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

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

So where is this phantom node 0.6.1-pre version and how can I get rid of it?

(那么这个幻影节点0.6.1-pre版本在哪里,我该如何摆脱它?)

I'm trying to install libraries via NPM so that I can work on a project.

(我正在尝试通过NPM安装库,以便可以在项目上工作。)

I tried using BREW to update before NVM, using "brew update" and "brew install node".

(我尝试使用BREW在NVM之前进行更新,使用“ brew update”和“ 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".

(我尝试删除/ usr / local / include中的“节点”目录以及“ / usr / local / lib”中的“节点”和“ node_modules”。)

I've tried uninstalling npm and reinstalling it following these instructions.

(我已尝试按照以下说明卸载npm并重新安装。)

All of this because I was trying to update an older version of node to install the "zipstream" library.

(所有这些都是因为我试图更新节点的旧版本以安装“ zipstream”库。)

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.

(现在,我的用户目录中有文件夹,并且节点版本STILL不是最新的,即使NVM表示它正在使用0.6.19。)

Ideally, I'd like to uninstall nodejs, npm, and nvm, and just reinstall the entire thing from scratch on my system.

(理想情况下,我想卸载nodejs,npm和nvm,然后从头开始重新安装整个系统。)

  ask by Dominic Tancredi translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Apparently, there was a /Users/myusername/local folder that contained a include with node and lib with node and node_modules .

(显然,存在一个/Users/myusername/local文件夹,其中包含一个include nodelib以及nodenode_modules 。)

How and why this was created instead of in my /usr/local folder, I do not know.

(我不知道是如何以及为什么创建它的,而不是在我的/usr/local文件夹中创建的。)

Deleting these local references fixed the phantom v0.6.1-pre.

(删除这些本地引用可修复幻影v0.6.1-pre。)

If anyone has an explanation, I'll choose that as the correct answer.

(如果有人有解释,我会选择它作为正确答案。)

EDIT:

(编辑:)

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

(或(与上述相同)损坏...)

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

(要完全卸载node + npm,请执行以下操作:)

  1. go to /usr/local/lib and delete any node and node_modules

    (转到/ usr / local / lib并删除任何节点node_modules)

  2. go to /usr/local/include and delete any node and node_modules directory

    (转到/ usr / local / include并删除任何nodenode_modules目录)

  3. if you installed with brew install node , then run brew uninstall node in your terminal

    (如果你安装了冲泡安装节点 ,然后在你的终端上运行的BREW卸载节点)

  4. check your Home directory for any local or lib or include folders, and delete any node or node_modules from there

    (检查主目录中是否有任何本地lib包含文件夹,并从此处删除任何节点node_modules)

  5. go to /usr/local/bin and delete any node executable

    (转到/ usr / local / bin并删除任何节点可执行文件)

You may also need to do:

(您可能还需要执行以下操作:)

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

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

(另外,NVM修改$HOME/.bashrc的PATH变量,该变量必须手动还原 。)

Then download nvm and follow the instructions to install node.

(然后下载nvm并按照说明安装节点。)

The latest versions of node come with npm , I believe, but you can also reinstall that as well.

(我相信node的最新版本是npm附带的,但是您也可以重新安装它。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...