Mac下npm报错

本文详细记录了在Mac环境下遇到的npm命令运行时出现的dyld: Library not loaded错误,通过卸载并重新安装node及icu4c库成功解决了问题。
1、今天在Mac下运行npm命令时不知什么原因报错如下:
☁  myhexo_blog [master] ⚡ node -v                            
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.59.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
[1]    33278 abort      node -v
2、解决方案:
☁  myhexo_blog [master] ⚡ brew uninstall --force node 
Uninstalling node... (4,152 files, 47.9MB)
☁  myhexo_blog [master] ⚡ brew uninstall icu4c && brew install icu4c 
Error: Refusing to uninstall /usr/local/Cellar/icu4c/63.1
because it is required by php and php@7.1, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies icu4c
☁  myhexo_blog [master] ⚡  brew unlink icu4c && brew link icu4c –force
Unlinking /usr/local/Cellar/icu4c/63.1... 0 symlinks removed
Error: No such keg: /usr/local/Cellar/–force
☁  myhexo_blog [master] ⚡ brew install node
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/node-11.8.0.mojave.bottle.t
######################################################################## 100.0%
==> Pouring node-11.8.0.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
?  /usr/local/Cellar/node/11.8.0: 3,938 files, 47.4MB
3、之后运行node -v显示如下:
☁  myhexo_blog [master] ⚡ node -v
v11.8.0

问题解决~ happy hacking...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值