How do I remove old versions of node/npm?

2020-03-02 04:26发布

I've been playing around with node a couple of months ago, as it's a fast evolving project, I thought I'd need to update it when I picked it up recently, not knowing how and having read about n, I installed that, installed the latest version.

Everything was OK until I tried to use npm, which wouldnt work, see this issue.

So I needed to remove n, I didn't know how so instead removed all the versions of node I had installed using n - {version} for each version I had.

I then ran the installer straight off the node.js website, hoping it would fix all the issues I'm having.

Node now works as expected, but npm is still not working.

The error that is shown in npm-debug.log when trying npm install {package} is :

ERR! Error: EISDIR, mkdir '/'
ERR! You may report this log at:
ERR!     <http://github.com/isaacs/npm/issues>
ERR! or email it to:
ERR!     <npm-@googlegroups.com>
ERR!
ERR! System Darwin 11.3.0
ERR! command "node" "/usr/local/bin/npm"
ERR! cwd /
ERR! node -v v0.6.15
ERR! npm -v 1.1.16
ERR! path /
ERR! code EISDIR
ERR! message EISDIR, mkdir '/'
ERR! errno {}

What I'm trying to do is re-install node + npm and start all over again.

I'm using a Mac, and have little experience with the commandline + file system in general with OS X, still trying to adjust from the Windows way.. (Control panel -> Uninstall -> ....).

Any help with this would be appreciated.

标签: node.js npm
1条回答
走好不送
2楼-- · 2020-03-02 05:31

Could you give it a shot with this script from the npm site?

It should clean up any old installations you have and install the latest version.

查看更多
登录 后发表回答