一尘不染

错误:“ brew link”步骤未成功完成

node.js

我正在尝试通过Homebrew安装node.js。不幸的是,我得到这个错误:

➜  ~  brew install node
==> Downloading http://nodejs.org/dist/v0.8.10/node-v0.8.10.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/node/0.8.10
==> make install
==> Caveats
Homebrew installed npm.
We recommend prepending the following path to your PATH environment
variable to have npm-installed binaries picked up:
  /usr/local/share/npm/bin
Warning: Could not link node. 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 node'
==> Summary
/usr/local/Cellar/node/0.8.10: 856 files, 13M, built in 103 seconds

因此,我尝试手动链接节点…

➜  ~  brew link node
Linking /usr/local/Cellar/node/0.8.10... Warning: Could not link node. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/node/0.8.10/lib/node_modules/npm/scripts/relocate.sh
Target /usr/local/lib/node_modules/npm/scripts/relocate.sh already exists. You may need to delete it.
To force the link and delete this file, do:
  brew link -f formula_name

To list all files that would be deleted:
  brew link -n formula_name

没有运气,所以我尝试强制链接节点…

➜  ~  brew link -f node
Linking /usr/local/Cellar/node/0.8.10... Warning: Could not link node. Unlinking...

Error: Permission denied - /usr/local/lib/dtrace/node.d

我在任何方面都不熟悉dtrace,而且害怕弄乱权限,所以我尝试sudo。

➜ ~ git:(master) sudo brew link -f node
Password:
Error: Cowardly refusing to `sudo brew link'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

我尝试通过卸载节点,brew uninstall node然后重试安装,但是没有运气。


阅读 824

收藏
2020-07-07

共1个答案

一尘不染

现在,用于node.js的Homebrew软件包再次包含了npm,因此,当我错过了homebrew软件包中有关先删除独立版本的消息时,这发生了。

假设,像我一样,你已经通过尝试升级知道要打破之前节点/ NPM npm uninstall npm -g首先,你可以rm -rf /usr/local/lib/node_modules/npmbrew link node。这将删除 独立的
自托管npm软件包(而不是要安装的一台brew),并让Brew从Cellar对其捆绑的软件包进行符号链接。

2020-07-07