gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 04:16:11 26 4
gpt4 key购买 nike

我遇到了一个问题,每次我尝试运行 npm install 命令时,我都会收到一个错误:'-bash: npm: command not found'
所以我尝试使用自制软件卸载并重新安装 node 和 npm,但仍然遇到一些错误。卸载两者后,我运行了命令:“brew doctor”,我得到“您的系统已准备好进行 brew”。

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

我也尝试过 brew postinstall node 并得到以下响应:
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

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

关于npm - 权限被拒绝覆盖或删除节点目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31466045/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com