自制 - 重复“链接”错误。这里的根本问题是什么?

时间:2013-10-24 17:37:46

标签: homebrew

所以我一直在使用自制软件在我的mac上安装各种软件包/库/程序。我一直遇到一个问题,其中自制软件告诉我,我的酒窖里有无链接的桶。

例如,在运行brew install phantomjs时,我收到以下消息:

Warning: Could not link phantomjs. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link phantomjs'

Possible conflicting files are:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs

我尝试按照建议运行brew link phantomjs,并遇到了类似的问题:

Error: Could not symlink file: /usr/local/Cellar/phantomjs/1.9.2/bin/phantomjs
Target /usr/local/bin/phantomjs already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
  brew link --overwrite formula_name

命令brew link --overwrite --dry-run phantomjs给出以下消息:

Would remove:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs

我可能会继续覆盖,但每次我尝试使用自制软件安装时都会发生这种情况。为什么?为什么自制软件不按预期工作?

感谢。

2 个答案:

答案 0 :(得分:1)

据我所知,看起来你以前做过:

% sudo npm install -g phantomjs

在这种情况下,您应该执行以下操作:

% sudo npm uninstall -g phantomjs
% brew link --overwrite phantomjs

答案 1 :(得分:0)

我以为我会对此采取行动。我今天遇到了类似的问题,我认为这可能与此有关:

https://github.com/Homebrew/homebrew/issues/22408

长话短说,我认为这与npm如何管理包与brew如何管理有关。 (我假设您安装了具有默认值的节点,这会给你npm)。

在某些时候你可能用npm安装了一些包。也许是咕噜咕噜,业力等等。默认情况下,最终会在/usr/local/lib/node_modules

也许其中一个软件包或其依赖项(或子依赖项)依赖于phantomjs(我认为Karma可能会使用phantomjs?)无论如何,如果现在你正在尝试酿造安装phantomjs,它试图对它进行符号链接,这可能与npm为您创建的现有符号链接冲突..

我认为您可以更改该程序包的符号链接路径,以便brew永久指向node_modules文件夹中已安装的程序包。对不起,不要再具体了,我自己也搞清楚了。

相关问题