被拒绝覆盖或删除节点目标的权限

时间:2015-07-16 23:09:12

标签: npm yosemite

我遇到了一个问题,每次我尝试运行npm install命令时都会收到错误:' -bash:npm:command not found' 所以我试图使用自制程序卸载并重新安装node和npm,但仍然遇到一些错误。在我卸载了两者之后,我运行了命令:" brew doctor"我得到了#34;你的系统已准备好酿造。"

首先我尝试安装节点:" 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

但似乎没有任何效果。

有谁知道如何获取删除权限和/或如何使这些文件可写,以便我可以覆盖或删除它们?

1 个答案:

答案 0 :(得分:14)

删除文件夹

sudo rm -rf /usr/local/share/systemtap/

如果需要,删除之前安装的所有节点。

brew uninstall node

然后重新安装节点

brew install node

我有同样的问题,为我工作。