使用brew install node时遇到的各种权限和link失败问题记录

参考了很多博主的方法,也看了很多stackoverflow,在用brew install node时总是会遇到如下问题:

Warning: node 10.4.1 is already installed, it's just not linked
You can use `brew link node` to link this version.


admindeMacBook-Pro:local zoey$ brew install node
Updating Homebrew...
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-61.1.high_sierra.bott
######################################################################## 100.0%
==> Pouring icu4c-61.1.high_sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have this software first in your PATH run:
 
For compilers to find this software you may need to set:    LDFLAGS:  -L/usr/local/opt/icu4c/lib    CPPFLAGS: -I/usr/local/opt/icu4c/include

于是我:

sudu vim ~/.bash_profile

然后把那两句echo加进去了,再source了一下。

 export PATH="/usr/local/opt/icu4c/bin:$PATH"
 export PATH="/usr/local/opt/icu4c/sbin:$PATH"
但是按照以前的步骤都没有解决,还参考了 Mac上完整卸载node.js 文章:

https://www.jianshu.com/p/3e0206dd23ac

各种卸载node、npm还有brew也重装了好几遍,最后终于解决了。

按照之前的提示,

brew link node

报如下错误:

The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink share/doc/node/lldb_commands.py
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/lldb_commands.py
Target /usr/local/share/doc/node/lldb_commands.py
already exists. You may want to remove it:
  rm '/usr/local/share/doc/node/lldb_commands.py'

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/doc/node/lldb_commands.py
/usr/local/share/doc/node/lldbinit


或者是:

再根据提示,

rm '/usr/local/share/doc/node/lldb_commands.py'

之前其他博主的解决方案对我都是无效的。说我各种没有权限,然后我用了sudo之后,又提示brew没法sudo,我还想改权限,输入了:sudo chown -R $(whoami):admin /usr/local

这个操作被拒绝了,于是放弃了。

在最后一次尝试最后一条指令的时候,即这条:

brew link --overwrite --dry-run node

提示为:


于是我cd到这个目录下面,直接手动把它给删除了。

然后再执行了一下:

rm '/usr/local/share/doc/node/lldb_commands.py'

终于提示它已经没有了:


于是我再执行:

brew link node

终于不报错了!!!!!!!


然后我继续install node:

brew install node

给我提示warning:


于是我听他的,执行了:

brew reinstall node

可算是好了。。。。。。真是没想到,本来没报多大希望的。多亏cd到那个目录下之后手动删除了那个可执行文件。

然后分别node -v  和npm -v检查了一下,node和npm都弄好啦!


小白第一次写文章~还望看官们海量~


  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值