我遇到了一个问题,每次我试图运行一个npm安装命令时,我都会收到一个错误:'-bash: npm: command not found'因此,我尝试使用自制软件卸载和重新安装node和npm,但仍然遇到一些错误。在我卸载了这两个程序之后,我运行命令:"brew doctor",然后得到"您的系统已准备好进行酿造"。
首先我尝试安装节点:"brew install node",但我得到以下内容:
==> Downloading https://homebrew.bintray.com/bottles/node-
0.12.7.yosemite.bottle
Already downloaded: /Library/Caches/Homebrew/node-0.12.7.yosemite.bottle.tar.gz
==> Pouring node-0.12.7.yosemite.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/systemtap/tapset/node.stp
Target /usr/local/share/systemtap/tapset/node.stp
already exists. You may want to remove it:
rm '/usr/local/share/systemtap/tapset/node.stp'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
Possible conflicting files are:
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall node`
==> Summary
🍺 /usr/local/Cellar/node/0.12.7: 2726 files, 31M
Jamess-MacBook-Pro:~ jamesbradley$
然后我尝试删除目标:
Jamess-MacBook-Pro:~ jamesbradley$ rm
'/usr/local/share/systemtap/tapset/node.stp'
override rw-r--r-- root/admin for /usr/local/share/systemtap/tapset/node.stp? y
rm: /usr/local/share/systemtap/tapset/node.stp: Permission denied
Jamess-MacBook-Pro:~ jamesbradley$
,得到如下结果:
rm: /usr/local/share/systemtap/tapset/node.stp: Permission denied
然后我尝试重写,得到这个错误:
Linking /usr/local/Cellar/node/0.12.7...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.
Jamess-MacBook-Pro:~ jamesbradley$
我也试图酿造postinstall节点,我得到这样的响应:
Error: Permission denied - /usr/local/lib/node_modules/npm
Jamess-MacBook-Pro:~ jamesbradley$
我也试过运行一些其他的命令:
sudo chown -R `whoami` /Library/Caches/Homebrew/
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
但似乎什么都不起作用。
有谁知道我如何获得删除权限和/或如何使这些文件可写,所以我可以覆盖或删除它们?
删除文件夹
sudo rm -rf /usr/local/share/systemtap/
删除之前安装的所有节点。
brew uninstall node
重新安装节点
brew install node
我也有同样的问题,对我来说是有效的