不能“酿造链接”是一个没有链接的桶

时间:2012-06-03 05:32:46

标签: node.js homebrew

$: 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

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

6 个答案:

答案 0 :(得分:45)

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

brew cleanup
brew link node
brew uninstall node
brew install node

答案 1 :(得分:1)

我得到了:

$ 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

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

brew link --overwrite --force node@8

答案 2 :(得分:0)

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

brew link --overwrite node

答案 3 :(得分:0)

我个人不得不为无法写的节点文件使用sudo chmod魔术。即使启用了--force,Brew默认也不照顾它们。

答案 4 :(得分:0)

echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.zshrc

答案 5 :(得分:0)

我为此困惑了很长时间。没有任何效果。 我使用的是 macOS。

在终端中,执行以下命令以使用适当的 node.js 设置获取 nvm 设置(有关脚本读取此 https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh 的内容的更多详细信息):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | zsh

重新启动终端并运行以下命令:

nvm -v 您应该会看到一个版本。

现在让我们安装节点:

nvm 安装 14.15 安装完成后,运行:

节点 -v

你应该没事了。

相关问题