我使用自制(Mojave)安装节点,之后php停止工作,如果我尝试运行php -v,我会得到这个错误:

php -v
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found

我尝试卸载node和icu4c,但问题仍然存在


当前回答

在我的情况下,我不得不在两个版本的icu4c之间切换,因为我仍然维护PHP 5.6项目(使用旧的icu4c 64.2)。由于某些原因,从原始.rb链接进行安装和重新安装总是会替换以前安装的版本。

#fetching 64.2
brew fetch https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb 

#fetching stable version
brew fetch https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/icu4c.rb 

cd $(brew --cache)/downloads
tar xvfz e2a83648f37dc5193016ce14fa6faeb97460258b214e805b1d7ce8956e83c1a7--icu4c-64.2.catalina.bottle.tar.gz
tar xvfz e045a709e2e21df31e66144a637f0c77dfc154f60183c89e6b04afa2fbda28ba--icu4c-67.1.catalina.bottle.tar.gz
mv -n icu4c/67.1 $(brew --cellar)/icu4c/
mv -n icu4c/64.2 $(brew --cellar)/icu4c/

然后在版本之间切换

$ brew switch icu4c 64.2
Cleaning /usr/local/Cellar/icu4c/64.2
Cleaning /usr/local/Cellar/icu4c/67.1
Opt link created for /usr/local/Cellar/icu4c/64.2

$ brew switch icu4c 67.1
Cleaning /usr/local/Cellar/icu4c/64.2
Cleaning /usr/local/Cellar/icu4c/67.1
Opt link created for /usr/local/Cellar/icu4c/67.1

其他回答

我的问题:

# npm install -g canvas

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

现在20210118,经过多次尝试:

...
brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/icu4c.rb
brew upgrade npm
brew install node
brew uninstall --ignore-dependencies node@8 icu4c
brew install icu4c
...

最终解决方案为:

重新安装NPM

这为我解决了问题:

brew upgrade node

在OSX 10.15.4上运行xcode-select——install修复了这个问题。

这是最后对我有用的方法。

酿造重新安装postgres

运行上述命令后,您可能需要运行

酿造postgresql-upgrade-database

访问您以前的数据。

Leland的答案对我来说很管用,但我不得不把第4步和第6步改为:

4) git checkout -B icu4c-62.1 575eb4b

6) brew重装Formula/icu4c.rb