我尝试修复在运行 npm 时必须使用 sudo 的错误。我盲目地按照链接卸载 Node ,代码来自这个gist
运行命令后,我尝试使用 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
来解决此问题。现在我已经正确安装了 Node 。
关于node.js - Node 已经安装,只是没有链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35249204/