dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

使用brew 安裝 yarn 以後 ,node環境報錯

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib
Referenced from: /usr/local/opt/node@8/bin/node
Reason: image not found

查找不少資料,仍是沒有徹底解決,通過的本身的實踐,解決了個人問題,但願對你有幫助。node

解決方法

brew list  # 查看安裝的軟件
brew uninstall --ignore-dependencies node icu4c  # 卸載軟件
brew uninstall nvm  #卸載nvm
brew uninstall node[@8](https://my.oschina.net/u/147515)  #卸載node[@8](https://my.oschina.net/u/147515)
brew uninstall yarn   #卸載 yarn

安裝軟件
brew install nvm
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.

You should create NVM's working directory if it doesn't exist:

  mkdir ~/.nvm

Add the following to ~/.zshrc or your desired shell
configuration file:

  export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion"  # This loads nvm bash_completion

You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.

Type `nvm help` for further information.

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/nvm/0.34.0: 7 files, 141.7KB, built in 8 seconds
  • 根據提示,建立文件,配置參數shell

    mkdir ~/.nvm
    	Add the following to ~/.zshrc or your desired shell
      configuration file:
    
        export NVM_DIR="$HOME/.nvm"
        [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
        [ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion"  # This loads nvm bash_completion
  • 再使用nvm 安裝nodenpm

    ~ nvm list
      			N/A
      iojs -> N/A (default)
      node -> stable (-> N/A) (default)
      unstable -> N/A (default)
      nvm_list_aliases:36: no matches found: /Users/caonn/.nvm/alias/lts/*
      ➜  ~ nvm install v8.11.2
      Downloading and installing node v8.11.2...
      Downloading https://nodejs.org/dist/v8.11.2/node-v8.11.2-darwin-x64.tar.xz...
      ######################################################################## 100.0%
      Computing checksum with shasum -a 256
      Checksums matched!
      Now using node v8.11.2 (npm v5.6.0)
      Creating default alias: default -> v8.11.2
      ➜  ~ node -v
      v8.11.2
      ➜  ~ npm -v
      5.6.0
      ➜  ~

測試後,能夠正常使用。

##【總結】bash

1.nvm,nodejs,brew 軟件使用不熟悉,liunx原理不熟。
2.解決思路,把全部相關軟件卸載後,從新安裝。
3.後面的node版本都是用nvm 管理。
相關文章
相關標籤/搜索