我使用自制(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,但问题仍然存在


当前回答

我看了这篇文章,这似乎是我所缺少的一块拼图:

brew uninstall node@8

其他回答

结果我和@Grey Black一样,不得不安装icu4c的v62.1版本。其他方法都不管用。

但是,酿造开关icu4c 62.1仅在过去安装过62.1的情况下才能工作。如果你还没有,就需要做更多跑腿的工作。Homebrew不容易安装以前版本的公式。

我是这样做的:

We first need a deep clone of the Homebrew repo. This may take a while: git -C $(brew --repo homebrew/core) fetch --unshallow brew log icu4c to track down a commit that references 62.1; 575eb4b does the trick. cd $(brew --repo homebrew/core) git checkout 575eb4b -- Formula/icu4c.rb brew uninstall --ignore-dependencies icu4c brew install icu4c You should now have the correct version of the dependency! Now just to... git reset && git checkout . Cleanup your modified recipe. brew pin icu4c Pin the dependency to prevent it from being accidentally upgraded in the future

如果你决定在某个时候升级它,一定要运行brew unpin icu4c

在最新的OS X更新后,似乎不可能使用brew链接icu4c。这让事情变得更有趣。我找到的唯一解决办法是:

下载并编译icu4c 62.1到/usr/local/icu4c/62.1

mkdir ~/sources
cd ~/sources
wget http://download.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
tar xvzf icu4c-62_1-src.tgz
cd icu/source/

sudo mkdir /usr/local/icu4c/62.1
./configure --prefix=/usr/local/icu4c/62.1
make
sudo make install

链接库:

ln -s /usr/local/icu4c/62.1/lib/*.dylib /usr/local/include/

在~/.bash_profile中设置DYLD_LIBRARY_PATH:

export DYLD_LIBRARY_PATH=/usr/local/include

这个要点中的解决方法帮了我

brew uninstall --ignore-dependencies node icu4c
brew install node

[2020]版

对我来说,就是用所需的版本安装icu4c。

如果你需要安装旧版本,如版本62,(其他版本相同的步骤),你需要:

用这个版本创建自己的repo(或找别人的repo) Brew tap(每个版本的链接都不同):

62年版本

https://raw.githubusercontent.com/Homebrew/homebrew-core/575eb4bbef683551e19f329f60456b13a558132f/Formula/icu4c.rb

64年版本

https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb 

66年版本

https://raw.githubusercontent.com/Homebrew/homebrew-core/22fb699a417093cd1440857134c530f1e3794f7d/Formula/icu4c.rb

67年版本

https://raw.githubusercontent.com/Homebrew/homebrew-core/88b9cc789820f2f544d8d4a1053eebb044c2926c/Formula/icu4c.rb

yourUsername / homebrew-versions /公式/ 将下载的文件放入“公式”文件夹 brew tap [yourUsername]/homebrew-versions brew install [yourUsername]/homebrew-versions/icu4c .使用实例 你说对了!

其中[yourUsername]是您的GitHub帐户或已经拥有所需版本的人的名称。

Unfortunately, latest homebrew gives no longer a warning and now displays the error: Error: Calling Installation of XXX from a GitHub commit URL is disabled! Use 'brew extract XXX' to stable tap on GitHub instead. So the way to go now is to create a new repo on github called homebrew-versions to host the Formula in a Tap Then initialise it with: brew tap-new MYORG/homebrew-versions after git cloning the homebrew repo as suggested by Shine Hugh, copy paste the raw ruby file to your new Formula. Beware the funny naming convention! Example: File name is: gettext@0.20.2.rb Class name is: GettextAT0202 Example: https://github.com/nedap/homebrew-versions source:https://itnext.io/how-to-install-an-older-brew-package-add141e58d32

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

酿造重新安装postgres

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

酿造postgresql-upgrade-database

访问您以前的数据。