When executing npm, icu4c reports an error. Use brew to install the old version of icu4c, icu4c 62.1

When I executed npm install as usual, the computer gave me a big blow

➜  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

According to the normal operation, I first check whether I can switch back to icu4c 62.1 through brew, and the result fails.
Check the reason and find that version 62.1 has been deleted

➜  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)

No way. Please reinstall the lower version of icu4c:

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

View git's submission records

➜  Formula git:(master) git log --follow icu4c.rb
commit e7f0f10dc63b1dc1061d475f1a61d01b70ef2cb7
Author: Mike McQuaid <mike@mikemcquaid.com>
Date:   Sun Jan 6 14:57:48 2019 +0000

    icu4c: remove old code.

commit bc0c97952453ff6afc146aa3a706e9902aba4300
Author: BrewTestBot <homebrew-test-bot@lists.sfconservancy.org>
Date:   Thu Nov 29 06:17:05 2018 +0000

    icu4c: update 63.1 bottle.

commit 8ce87beeaea9ff3b9b1e811c4087b6a2f0cb0c2c
Author: FX Coudert <fxcoudert@gmail.com>
Date:   Wed Nov 28 10:03:16 2018 +0100

    icu4c 63.1

commit 575eb4bbef683551e19f329f60456b13a558132f
Author: Viktor Szakats <commit@vszakats.net>
Date:   Tue Oct 9 02:55:55 2018 +0000

    icu4c: secure/fix/follow url(s)

commit c179a064276d698d66953898ff9e02d6e0664b2a
Author: BrewTestBot <brew-test-bot@googlegroups.com>
Date:   Wed Aug 15 21:51:09 2018 +0000

    icu4c: update 62.1 bottle.

commit 2235a91cedb2038a7c721796b48e63836c792607
Author: ilovezfs <ilovezfs@icloud.com>
Date:   Tue Jul 24 09:44:31 2018 +0200

    icu4c: remove head spec (#30427)

commit e6b65d7433d0a18c36eb584be554500b6ec06884
Author: BrewTestBot <brew-test-bot@googlegroups.com>
Date:   Fri Jun 22 02:12:37 2018 +0000

    icu4c: update 62.1 bottle.

commit 004bdfeef173becdc7e1344a4c095945a97ca410
Author: Chongyu Zhu <i@lembacon.com>
Date:   Thu Jun 21 08:27:56 2018 +0800

    icu4c 62.1
    
/////It's a long time. It's meaningless

Commit to 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 reinstall 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

Then use npm to see if it can run normally

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

Tags: brew npm git

Posted on Fri, 29 Nov 2019 07:08:12 -0800 by rickbond79