node.js 不能“酿造链接”一个未链接的小桶

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10868133/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 15:49:28  来源:igfitidea点击:

Can't `brew link` an unlinked keg

node.jshomebrew

提问by Jordan Feldstein

$: which node
$: node
-bash: node: command not found
$: brew install node
Error: node-0.6.18 already installed
$: brew doctor
Error: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built.

node

$: brew link node
Error: No such file or directory - /usr/local/Cellar/node/0.6.5
$: brew uninstall node
Error: No such file or directory - /usr/local/Cellar/node/0.6.5
$: brew install node
Error: node-0.6.18 already installed

How do I get my node back on track??

我如何让我的节点回到正轨?

回答by Jordan Feldstein

I was able to relink the correct version of node by running:

我能够通过运行重新链接正确版本的节点:

brew cleanup
brew link node
brew uninstall node
brew install node

回答by Adam Chwedyk

I was getting:

我得到:

$ brew link node
Error: No such keg: /usr/local/Cellar/node
$ brew link node@8
Warning: node@8 is keg-only and must be linked with --force

That command helped to get everything working again:

该命令有助于让一切恢复正常:

brew link --overwrite --force node@8

回答by L_Sonic

I personally had to work some sudo chmod magic for node files that were not writable. Brew didn't take care of them by default even after --force was enabled.

我个人不得不为不可写的节点文件使用一些 sudo chmod 魔法。即使在启用 --force 之后,Brew 默认也没有处理它们。

回答by user3681732

To force the link and overwrite all conflicting files:

要强制链接并覆盖所有冲突文件:

brew link --overwrite node