所以我犯了一个错误,试图摆脱所有 sudo 依赖项。我从站点下载了 npm 作为一个包并进行了手动/全局安装。但似乎我总是不得不使用 sudo 运行......所以我尝试卸载并使用 Homebrew 软件运行。
现在我什至无法让 node 或 npm 运行...我想我必须用 brew link 链接它们,但我收到了这个错误:
Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
rm '/usr/local/share/doc/node/gdbinit'
我试过删除它: 而且我的权限被拒绝了。
我尝试过运行 brew prune。 我尝试使用以下步骤卸载然后重新安装:
$ brew uninstall npm
$ brew uninstall node
$ npm uninstall npm -g
$ sudo rm -rf /usr/local/lib/node_module
Error: The 'brew link' step did not complete successfully
我正在运行 Yosemite 10.10.5。我安装了 git 版本 2.6.0。我的 Homebrew 软件已更新。一位 brew doctor 给了我这个警告:
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
node
不知道从这里去哪里。我正在努力摆脱对 CodeKit 的依赖,开始大吃一惊。
最佳答案
看起来 /usr/local
中的几个文件和目录现在归 root
所有,因为您使用 sudo
运行了几个步骤>。要摆脱这些,请收回 /usr/local
下所有文件和目录的所有权:
sudo chown -R $(whoami) $(brew --prefix)/*
完成后,再次运行 brew doctor
。
可以在这里找到类似的问题:
关于node.js - Homebrew npm 安装 : could not symlink,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32849741/