執行npm時icu4c報錯,使用brew安裝舊版本icu4c,icu4c 62.1

當我像往常一樣執行npm install的時候,電腦給我了一個重大的打擊

➜  RNDemo npm install
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
[1]    4976 abort      npm install

按照常規操作,我先通過brew查看能不能切換回icu4c 62.1,結果失敗了。
查看原因,發現62.1版本已經被刪了

➜  RNDemo  brew switch icu4c 62.1
Error: icu4c does not have a version "62.1" in the Cellar.
icu4c installed versions: 63.1
➜  RNDemo brew list icu4c
/usr/local/Cellar/icu4c/63.1/bin/derb
/usr/local/Cellar/icu4c/63.1/bin/genbrk
/usr/local/Cellar/icu4c/63.1/bin/gencfu
/usr/local/Cellar/icu4c/63.1/bin/gencnval
/usr/local/Cellar/icu4c/63.1/bin/gendict
/usr/local/Cellar/icu4c/63.1/bin/genrb
/usr/local/Cellar/icu4c/63.1/bin/icu-config
/usr/local/Cellar/icu4c/63.1/bin/icuinfo
/usr/local/Cellar/icu4c/63.1/bin/makeconv
/usr/local/Cellar/icu4c/63.1/bin/pkgdata
/usr/local/Cellar/icu4c/63.1/bin/uconv
/usr/local/Cellar/icu4c/63.1/include/unicode/ (183 files)
/usr/local/Cellar/icu4c/63.1/lib/libicudata.63.1.dylib
/usr/local/Cellar/icu4c/63.1/lib/libicui18n.63.1.dylib
/usr/local/Cellar/icu4c/63.1/lib/libicuio.63.1.dylib
/usr/local/Cellar/icu4c/63.1/lib/libicutest.63.1.dylib
/usr/local/Cellar/icu4c/63.1/lib/libicutu.63.1.dylib
/usr/local/Cellar/icu4c/63.1/lib/libicuuc.63.1.dylib
/usr/local/Cellar/icu4c/63.1/lib/icu/ (4 files)
/usr/local/Cellar/icu4c/63.1/lib/pkgconfig/ (3 files)
/usr/local/Cellar/icu4c/63.1/lib/ (18 other files)

沒辦法,重裝低版本的icu4c吧:

➜  Desktop cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula

查看git的提交記錄

➜  Formula git:(master) git log --follow icu4c.rb
commit e7f0f10dc63b1dc1061d475f1a61d01b70ef2cb7
Author: Mike McQuaid <[email protected]>
Date:   Sun Jan 6 14:57:48 2019 +0000

    icu4c: remove old code.

commit bc0c97952453ff6afc146aa3a706e9902aba4300
Author: BrewTestBot <[email protected]>
Date:   Thu Nov 29 06:17:05 2018 +0000

    icu4c: update 63.1 bottle.

commit 8ce87beeaea9ff3b9b1e811c4087b6a2f0cb0c2c
Author: FX Coudert <[email protected]>
Date:   Wed Nov 28 10:03:16 2018 +0100

    icu4c 63.1

commit 575eb4bbef683551e19f329f60456b13a558132f
Author: Viktor Szakats <[email protected]>
Date:   Tue Oct 9 02:55:55 2018 +0000

    icu4c: secure/fix/follow url(s)

commit c179a064276d698d66953898ff9e02d6e0664b2a
Author: BrewTestBot <[email protected]>
Date:   Wed Aug 15 21:51:09 2018 +0000

    icu4c: update 62.1 bottle.

commit 2235a91cedb2038a7c721796b48e63836c792607
Author: ilovezfs <[email protected]>
Date:   Tue Jul 24 09:44:31 2018 +0200

    icu4c: remove head spec (#30427)

commit e6b65d7433d0a18c36eb584be554500b6ec06884
Author: BrewTestBot <[email protected]>
Date:   Fri Jun 22 02:12:37 2018 +0000

    icu4c: update 62.1 bottle.

commit 004bdfeef173becdc7e1344a4c095945a97ca410
Author: Chongyu Zhu <[email protected]>
Date:   Thu Jun 21 08:27:56 2018 +0800

    icu4c 62.1
    
/////很長,後面的也沒意義了

切換到62.1的提交

➜  Formula git:(icu4c-62.1) git checkout -b icu4c-62.1 e6b65d7433d0a18c36eb584be554500b6ec06884
Checking out files: 100% (4667/4667), done.
Switched to a new branch 'icu4c-62.1'

brew重新安裝icu4c

➜  Formula git:(icu4c-62.1) brew reinstall ./icu4c.rb
==> Reinstalling icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-62.1.high_sierra.bottle.tar.gz
Already downloaded: /Users/youssef/Library/Caches/Homebrew/downloads/a5c4ecb8f411b03f47332aae44d1a71dddb3a6d7ea70b2d0e2e4b15e41be020d--icu4c-62.1.high_sierra.bottle.tar.gz
==> Pouring icu4c-62.1.high_sierra.bottle.tar.gz
==> Caveats
icu4c 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 icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/icu4c/62.1: 250 files, 67.3MB

然後再使用npm看看,已經可以正常運行了

➜  RNDemo npm install -g npm
⸨░░░░░░░░░░░░░░░░░░⸩ ⠇ loadRequestedDeps: sill install loadAllDepsIntoIdealTree

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