我正在尝试通过 Homebrew 程序重新安装node.js,它已安装但未链接。当我尝试使用 brew link --overwrite node 覆盖冲突文件时,出现以下错误。有没有办法来解决这个问题? (我对此真的很陌生)
bubblenote$ brew更新&&brew安装 Node
Already up-to-date.
Warning: node 10.5.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
bubblenote$ brew 链接 Node
Linking /usr/local/Cellar/node/10.5.0...
Error: Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists.
您可能想要删除它:
rm '/usr/local/share/doc/node/gdbinit'
强制链接并覆盖所有冲突文件:
brew link --overwrite node
列出所有要删除的文件:
brew link --overwrite --dry-run node
bubblenote$ brew 链接 --覆盖 Node
Linking /usr/local/Cellar/node/10.5.0...
Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.
最佳答案
Error: Could not symlink share/doc/node/gdbinit /usr/local/share/doc/node is not writable.
这似乎表明您没有对该文件的写访问权限或者该文件是只读的。
尝试手动删除该文件,如果不能,则确实您没有写入权限。如果是这种情况,请尝试使用 sudo
运行该命令,看看是否有效。
编辑: 尝试以下操作使目录可写
chmod +w <directory>
关于node.js - 覆盖冲突文件链接node.js时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50979296/