首先,我在node
终端上运行macOS,
bash: /usr/local/bin/node: No such file or directory
我运行brew install node
Warning: node 12.10.0 is already installed, it's just not linked You can use `brew link node` to link this version.
所以我运行brew link node
Error: Could not symlink include/node/common.gypi
/usr/local/include/node is not writable.
我想这是个许可问题。所以我用sudo运行它,然后
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
然后,我尝试brew uninstall node
,并重复所有上述步骤,但仍然得到相同的错误。我做什么好?
发布于 2019-09-24 01:07:00
我想通了。做brew link --overwrite node
是有效的。
发布于 2019-09-18 04:46:41
备注:永远不要在brew
中使用sudo
。将brew
作为root
运行可能会更改brew相关文件的所有者,并使当前用户无法访问它。
问题的答案:您可能已经通过使用/usr/local/include/node
sudo
破坏了sudo
目录的权限。为了解决这个问题,
rm -rf /usr/local/include/node
brew unlink node
brew link node
如果上面的命令没有解决您的问题。尝试递归地修复/usr/local
下的所有文件夹权限。然后再尝试上面的修正。
sudo chown -R $(whoami):admin /usr/local/*
https://stackoverflow.com/questions/57984026
复制相似问题