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

19 浏览
0 Comments

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

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

有任何解决办法吗?

0
0 Comments

在Mojave || Catalina || Big Sur || Monterey || Ventura操作系统上,出现了(Node already installed, it's just not linked)问题。这个问题的出现是由于节点已经安装,但没有链接导致的。解决这个问题的方法是使用以下命令:

sudo chown -R $(whoami) $(brew --prefix)
brew link --overwrite node

这个方法在我使用 macOS Catalina 操作系统时解决了此问题。非常感谢!

0
0 Comments

原因:在安装Node时,可能出现权限问题或文件所有权的错误,导致无法正确链接Node。

解决方法:

1. 首先运行sudo chown -R $USER /usr/local,将/usr/local文件夹的所有权转移到当前用户。

2. 然后运行brew link node,将Node正确链接到系统中。

3. 在完成安装后,可以选择将/usr/local文件夹的所有权切换回root用户,运行sudo chown -R root /usr/local

4. 如果在OSX High Sierra中无法更改/usr/local的所有权,可以尝试使用sudo chown -R $(whoami) $(brew --prefix)/*命令。

5. 在某些情况下,可能需要执行brew link --overwrite node命令来覆盖现有的链接。

6. 对于Mojave 10.14.2和10.14.6版本,markhops和vikzilla的评论提供了解决方法。

7. 对于Big Sur 11.1版本,vikzilla的方法也适用。

8. 如果出现"Operation not permitted"错误,可以参考desloovere_j的回答进行解决。

9. 不要执行sudo chown -R root /usr/local命令,因为/usr/local中的一些文件和文件夹需要由用户拥有,而不是root。执行该命令可能导致写入权限错误。

这些方法可以帮助解决Node已安装但未链接的问题。

0
0 Comments

Node already installed, it's just not linked的问题出现的原因是Node已经安装了,只是没有链接。解决方法如下:

1. 打开终端,输入以下命令:

sudo chmod 776 /usr/local/lib

2. 输入以下命令:

brew link --overwrite node

输出结果应该是:

Linking /usr/local/Cellar/node/9.6.1... 49 symlinks created

3. 最后输入以下命令:

sudo chmod 755 /usr/local/lib

感谢!这是唯一有效的解决方法。

谢谢!这个方法对我有效。

谢谢你!!!!!!

完美解决!

0