【问题标题】:brew fails to install node on mac os big surbrew 无法在 mac os big sur 上安装节点
【发布时间】:2021-04-17 12:29:19
【问题描述】:

按照通常的tutorial 进行节点安装时,我收到以下错误:

➜  ~ node
zsh: command not found: node
➜  ~ brew install node
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 1 cask.

Warning: node 15.5.1 is already installed, it's just not linked
You can use `brew link node` to link this version.
➜  ~ brew link node
Linking /usr/local/Cellar/node/15.5.1...
Error: Could not symlink include/node/cppgc/allocation.h
Target /usr/local/include/node/cppgc/allocation.h
already exists. You may want to remove it:
  rm '/usr/local/include/node/cppgc/allocation.h'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node

➜  ~ brew link --overwrite node
Linking /usr/local/Cellar/node/15.5.1...
Error: Could not symlink include/node/cppgc/allocation.h
/usr/local/include/node/cppgc is not writable.

我需要修复权限吗?目前只有我一个人遇到这个问题吗?

【问题讨论】:

  • 你试过brew uninstall node然后brew install node吗?
  • 是的,我做了,但没有帮助,但为了解决它,我按照此处描述的步骤修复 brew:*.com/questions/32849741/…
  • 尝试错误消息中指定的rm '/usr/local/include/node/cppgc/allocation.h',然后重试以brew link node链接节点

标签: node.js homebrew macos-big-sur


【解决方案1】:

我的案例是在 MacOs Big Sur 11.2.2

当我运行brew install node 时,错误输出和你的一样。

接下来的步骤我可以完美运行节点:

sudo chmod -R $(whoami):admin /usr/local/inclue/node
sudo chmod -R $(whoami):admin /usr/local/share/doc/node
sudo chmod -R $(whoami):admin /usr/local/share/systemtap/tapset
sudo chmod -R $(whoami):admin /usr/local/lib/dtrace
brew link --overwrite node

希望能帮到你:)

【讨论】:

  • 现在我已经 brew 启动并运行,所以我不想尝试它;)但下次我遇到麻烦时,我会尝试你的建议并验证。也许有同样问题的其他人可以提供一些见解,无论它是否有帮助。谢谢!