节点已经安装,只是没有链接

新手上路,请多包涵

我试图修复运行 npm 时必须使用 sudo 的错误。我盲目地按照链接卸载节点,代码来自这个 要点

运行命令后,我尝试使用 brew: brew install node 重新安装它。这给了我以下错误:

 Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.

You can try again using:
  brew link node

尝试运行 brew link node ,我得到:

 Linking /usr/local/Cellar/node/5.4.0...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.

然后当我写 brew install npm 时,我得到:

 Warning: node-5.4.0 already installed, it's just not linked

当我写 npm -v 我得到:

 env: node: No such file or directory

关于如何解决这个问题的任何想法?

原文由 Ela 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 626
2 个回答

我设法通过首先运行 sudo chown -R $USER /usr/local 并使用 brew link node 来解决这个问题。现在我已经正确安装了节点。

原文由 Ela 发布,翻译遵循 CC BY-SA 3.0 许可协议

这个解决方案有效!它是所有组合的组合。

使用以下代码修复它。

  1. sudo chmod 776 /usr/local/lib
  2. brew link --overwrite node

输出: Linking /usr/local/Cellar/node/9.6.1... 49 symlinks created

  1. sudo chmod 755 /usr/local/lib

原文由 desloovere_j 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题