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

我试图修复错误,在运行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 

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

我设法解决这个问题,首先运行sudo chown -R $USER /usr/local ,然后使用brew link node 。 现在我有节点正确安装。

我确实有同样的问题,当我brew link jq但引用/usr/local/lib is not writable 。 在我的一台机器上,我无法应用Ela的build议。 我做了sudo chmod 776 /usr/local/lib然后我确定了成功的brew link jq ,然后将其更改回sudo chmod 755 /usr/local/lib

  1. sudo chown -R $ USER / usr / local
  2. brew链接 – 覆盖节点