无法更新npm - 代码EN0ENT -2

时间:2015-09-14 14:52:12

标签: node.js npm

我刚用Homebrew来安装Node。这似乎没问题,但是当我尝试用

更新npm时
npm install -g npm

我收到以下错误:

ERR! addLocal Could not install /Users/myusername/-g
ERR! Darwin 14.3.0
ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "npm"
ERR! node v0.12.7
ERR! npm v2.14.2
ERR! path /Users/myusername/-g
ERR! code EN0ENT
ERR! errno -2

ERR! enoent EN0NT, open '/Users/myusername/-g'

1 个答案:

答案 0 :(得分:1)

这在过去对我有用,也有类似的问题:

npm cache clean

您也可以尝试将其作为sudo

运行
sudo npm install -g npm