笑故挽风 2012-06-24 13:40 采纳率: 100%
浏览 1847
已采纳

如何完全卸载 Node.js 并从头重新安装(macosx)

My version of node is always v0.6.1-pre even after I install brew node and NVM install 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 ls
v0.6.19
current:    v0.6.19

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)

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.

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.

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.

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

转载于:https://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x

  • 写回答

17条回答 默认 最新

  • larry*wei 2012-06-24 14:04
    关注

    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.

    Deleting these local references fixed the phantom 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:

    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

    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.

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(16条)

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站