Mac下npm報錯

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 [email protected], 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...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章