我使用Homebrew (Mojave)安装了Node.js后,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,但问题仍然存在。
我使用Homebrew (Mojave)安装了Node.js后,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 remove php
和 brew install php
无法解决问题,brew reinstall php
也不行。
我的解决方法是执行:
brew remove php
cd /usr/local/Cellar
rm -rf php/
brew install php
brew doctor
brew cleanup
php -v
给我的输出是:PHP 7.3.2 (cli) (built: Feb 14 2019 10:08:45) ( NTS )
我的问题:
# 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
...
最终的解决方案是:
brew reinstall npm
brew reinstall npm
命令解决了我的问题。 - bartpie对我来说,它出现在node@12上。以下步骤适用于我 -
brew uninstall --ignore-dependencies icu4c
brew install node
这将自动安装icu4c并修复整个问题。
对我来说,brew reinstall nodejs
解决了这个问题 - 我遇到的问题是与运行 Elixir/Phoenix 有关,所以不是 PHP 特定的问题,我认为它是由 brew install postgres
引起的,但重新安装并没有帮助。我是通过 npm
命令获得它的。
实际上,我直接在homebrew网站找到了解决办法:https://docs.brew.sh/Common-Issues
升级macOS可能会导致以下错误:
xcode-select --install
brew upgrade
经过多年的处理,以下意外简单的解决方案对我起了作用:
最新版本:https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/icu4c.rb
brew reinstall icu4c.rb
来源:https://gist.github.com/hgrimelid/703691ab48c4a4d0537cfe835b4d55a6
brew update && brew upgrade
对我有效
以下是最终对我起作用的方法。
brew reinstall postgres
运行上述命令后,您可能需要运行
brew postgresql-upgrade-database
以访问您以前的数据。
brew remove node && brew install node
。 - Joshua Richardson为了降级,我不得不重新编译源代码(MacOS Mojave)
$ wget https://ssl.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
$ tar xvfz icu4c-62_1-src.tgz
$ cd icu/sources
$ ./configure
$ make
$ make install
/usr/local/opt/icu4c
目录不存在,并且brew reinstall icu4c
命令在 icu4c 目录上出现了很多 "permission denied" 错误。所以我使用了sudo rm -rf /usr/local/Cellar/icu4c
命令删除了目录,然后再次执行brew reinstall icu4c
命令,一切都正常了。 - Seth Johnsonbrew upgrade
就帮助了我。 - Maxim Yefremov