错误:"brew link"步骤未成功完成 [英] Error: The 'brew link' step did not complete successfully

查看:76
本文介绍了错误:"brew link"步骤未成功完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to install node.js via Homebrew. Unfortunately, I get this error:

➜  ~  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

所以我尝试手动链接节点...

So then I try to link node manually...

➜  ~  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

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

No luck, so I try forcefully linking node...

➜  ~  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.

I'm not familiar with dtrace in any regard and I'm afraid to mess with permissions, so I tried to 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卸载节点,然后重试安装,但是没有运气.

I've tried uninstalling node via brew uninstall node and retrying the install with no luck.

推荐答案

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

The homebrew package for node.js now includes npm again, so this happened to me when I missed the homebrew package's message about removing the standalone version first.

假设像我一样,您在尝试升级之前先尝试升级就已经破坏了节点/npm,先可以先rm -rf /usr/local/lib/node_modules/npm,然后再brew link node.这会删除 standalone 自托管的npm软件包(而不是一个brew想要安装的软件包),并通过brew将其捆绑的一个软件包从Cellar进行符号链接.

Assuming, like me, you've already broken node/npm by attempting the upgrade before knowing to npm uninstall npm -g first, you can rm -rf /usr/local/lib/node_modules/npm and then brew link node. This removes the standalone self-hosted npm package (rather than the one brew would like to install) and lets brew symlink its bundled one from Cellar.

这篇关于错误:"brew link"步骤未成功完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆