我使用自制(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,但问题仍然存在
当前回答
Leland的答案对我来说很管用,但我不得不把第4步和第6步改为:
4) git checkout -B icu4c-62.1 575eb4b
6) brew重装Formula/icu4c.rb
其他回答
[2022 Build It Yourself Edition]
适用于我的Mac OS 11.6.8大苏尔。
$ wget https://github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1-src.tgz
$ # In Finder, copy from Downloads/ to your home directory
$ tar xzvf icu4c-69_1-src.tgz
$ cd icu/source
$ ./configure
$ make
$ make install
在那之后,node和npm又开始工作了。
参考文献
@Taher的回答 https://stackoverflow.com/a/63045892/16681513
实际上,我很惊讶这个解决方案还没有提出,我觉得这是最简单的解决方案。
去GitHub,找到与你需要的icu4c版本匹配的brewfile版本,并获得文件的原始版本(按照上面的链接,然后单击“查看文件然后原始”)。
然后让brew从那个url重新安装。
例如,版本62.1:
brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/575eb4bbef683551e19f329f60456b13a558132f/Formula/icu4c.rb
例如,版本64.2:
brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
更新:
Homebrew的新版本可能要求您先下载该文件。如果是这样:
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
brew reinstall icu4c.rb
结果我和@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
在我的情况下,我重新安装与Homebrew安装的所有包
$ brew list | xargs brew reinstall
之后,我开始安装我需要的版本
2021-02简单解决方案
在处理这个问题多年后,下面的解决方案对我来说非常简单:
在您需要的版本的web浏览器中打开原始文件:
版本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
最新版本:https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/icu4c.rb
复制粘贴内容到一个名为: icu4c.rb 在新创建的文件上执行以下命令
来源:https://gist.github.com/hgrimelid/703691ab48c4a4d0537cfe835b4d55a6