While trying to fix a JPG compatibility issue, I'm running into the following error when trying to update npm on my Mac OSX (Yosemite). Note that I did not install via homebrew, instead via the official package. (I'm using version 0.10.37 to counteract yet another NPM package issue).
在试图修复JPG兼容性问题时,我在试图更新Mac OSX (Yosemite)上的npm时遇到了以下错误。注意,我不是通过自制程序安装的,而是通过官方程序包安装的。(我使用的是0.10.37版本,以抵消另一个NPM包问题)。
Here are the steps I take:
以下是我采取的步骤:
-
brew uninstall node
andbrew uninstall npm
to be triple-sure Node is not present on my system via Homebrew. The output is as expected,Error: No such keg: /usr/local/Cellar/node
brew uninstall node和brew uninstall npm是三重肯定节点,我的系统上没有Homebrew。输出如预期的那样,错误:没有这样的keg: /usr/local/Cellar/node
-
Download the package from http://nodejs.org/dist/v0.10.37/ and install it.
从http://nodejs.org/dist/v0.10.37/下载这个包并安装它。
-
node -v
to verify that Node is installed.节点-v,以验证已安装该节点。
-
npm update -g npm
npm更新- g npm
And here's the output from that last command:
这是最后一个命令的输出:
$ npm update -g npm
npm ERR! Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm
File exists: /usr/local/share/man/man3/npm-bin.3
Move it away, and try again.
npm ERR! System Darwin 14.1.0
npm ERR! command "node" "/usr/local/bin/npm" "update" "-g" "npm"
npm ERR! cwd /Users/topher
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/share/man/man3/npm-bin.3
npm ERR! code EEXIST
npm ERR! error rolling back Error: Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm
npm ERR! error rolling back at clobberFail (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:57:12)
npm ERR! error rolling back at next (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:43:14)
npm ERR! error rolling back at /usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:52:12
npm ERR! error rolling back at Object.oncomplete (evalmachine.<anonymous>:108:15)
npm ERR! error rolling back { [Error: Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm] code: 'EEXIST', path: '/usr/local/share/man/man3/npm-bin.3' }
npm ERR! not ok code 0
When I delete the above mentioned file and try again, I get another error because the npm
command no longer exists. It looks like the update partially succeeded in that the npm
command was deleted:
当我删除上面提到的文件并再次尝试时,我得到另一个错误,因为npm命令不再存在。看起来更新部分成功了,npm命令被删除了:
$ npm
-bash: /usr/local/bin/npm: No such file or directory
When I search for this "Refusing to delete" error, I see tons of advice for how to fix a botched Homebrew install (plus some unnecessarily condescending instructions on how to remove the Homebrew package. But I'm not installing the package via homebrew; the advice I'm finding there doesn't seem relevant in my case.
当我搜索这个“拒绝删除”的错误时,我看到了大量关于如何修复拙劣的Homebrew安装的建议(以及一些不必要的关于如何删除Homebrew软件包的居高临下的说明)。但我不是通过homebrew安装软件包;我发现的建议似乎与我的情况无关。
How should I go about troubleshooting this? Anyone else know of / have this problem / can think of a quick fix?
我应该如何进行故障排除?有人知道/有这个问题/能想出一个快速的解决办法吗?
Thanks in advance!
提前谢谢!
2 个解决方案
#1
0
This isn't a complete answer, but just to follow up I found a way to work around this issue.
这不是一个完整的答案,但是为了跟进,我找到了解决这个问题的方法。
My ultimate need was to get node
running with the package resemble
installed. Resemble relies on cairo
, which was installed via homebrew; it seems that this was my first mistake. Because Cairo was apparently improperly installed, a couple packages were missing; this forced me to use one workaround that triggered other errors and required other workarounds... and so forth.
我的最终需求是让node运行与包相似的安装。like依赖于cairo,它是通过homebrew安装的;这似乎是我的第一个错误。由于Cairo安装不当,因此丢失了两个包;这迫使我使用一个触发其他错误的解决方案,并需要其他的解决方案……等等。
When I removed the Cairo homebrew package and instead built Cairo from source (using this guide), several other errors I was having just melted away.
当我删除Cairo自制程序包,而是从源代码(使用本指南)构建Cairo时,我又犯了几个错误。
So the lesson I'm learning is: Don't use Homebrew for anything finnicky, or for any dependencies of anything finnicky.
所以我学到的教训是:不要用自制的东西来做任何事情,或者任何事情的依赖。
#2
0
I solve it by this:
我这样解它:
rm /usr/bin/npm
/usr/lib64/node_modules/npm/bin/npm-cli.js install npm -g
npm -v # success !
#1
0
This isn't a complete answer, but just to follow up I found a way to work around this issue.
这不是一个完整的答案,但是为了跟进,我找到了解决这个问题的方法。
My ultimate need was to get node
running with the package resemble
installed. Resemble relies on cairo
, which was installed via homebrew; it seems that this was my first mistake. Because Cairo was apparently improperly installed, a couple packages were missing; this forced me to use one workaround that triggered other errors and required other workarounds... and so forth.
我的最终需求是让node运行与包相似的安装。like依赖于cairo,它是通过homebrew安装的;这似乎是我的第一个错误。由于Cairo安装不当,因此丢失了两个包;这迫使我使用一个触发其他错误的解决方案,并需要其他的解决方案……等等。
When I removed the Cairo homebrew package and instead built Cairo from source (using this guide), several other errors I was having just melted away.
当我删除Cairo自制程序包,而是从源代码(使用本指南)构建Cairo时,我又犯了几个错误。
So the lesson I'm learning is: Don't use Homebrew for anything finnicky, or for any dependencies of anything finnicky.
所以我学到的教训是:不要用自制的东西来做任何事情,或者任何事情的依赖。
#2
0
I solve it by this:
我这样解它:
rm /usr/bin/npm
/usr/lib64/node_modules/npm/bin/npm-cli.js install npm -g
npm -v # success !