brew 无法在 mac os big sur 上安装节点

时间:2021-01-12 14:28:26

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

当按照通常的 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.

我需要修复权限吗,我是目前唯一遇到的人吗?

1 个答案:

答案 0 :(得分: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

希望能帮到你:)