我使用自制(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,但问题仍然存在
我使用自制(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,但问题仍然存在
当前回答
我的问题:
# 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
其他回答
我的问题:
# 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 cleanup可能会修复此错误,如果这本身无法修复它,您可以尝试升级单个包或所有的brew包。
我也有同样的问题。升级Homebrew然后清理对我来说很有效。这个错误可能是由于包版本不匹配造成的。上面的解决方案都不能解决我的错误,但是运行下面的自制程序命令可以。
注意:这将升级你所有的酿造包,包括但不限于PHP。如果你只想升级特定的包,请确保是特定的。
brew upgrade icu4c
brew upgrade // or upgrade all packages
最后
brew cleanup
对我来说,brew重装nodejs修复了这个问题-我的问题是运行Elixir/Phoenix,所以不是PHP特定的,我认为这是由brew安装postgres引起的,但重新安装没有帮助。我从npm命令中得到它。
在我的情况下,我重新安装与Homebrew安装的所有包
$ brew list | xargs brew reinstall
之后,我开始安装我需要的版本
关于恢复icu4c丢失版本有很多答案。我在postgresql中也有同样的错误,我想这可以在依赖于动态链接该库的各种程序中体现出来。
对于我来说,我使用的是特定版本的postgresql,即postgresql@12。我发现最简单的方法就是重新安装
brew reinstall postgresql@12
我想这也适用于php。