我使用自制(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
其他回答
[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
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
我的问题:
# 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
我实际上尝试了所有有意义的解决方案,在这篇文章中提到的,但我仍然在运行php -v或composer时得到相同的错误。 节点版本很好,npm也没有安装正确版本的问题,它们都在运行。 运行重新安装php@7.1会抛出一个错误。 最后我不得不逃跑:
brew reinstall icu4c
这基本上是可行的,我必须手动安装php依赖项,如imagick。所以,imap.so 由于这些库是为一个我不再维护的项目安装的,我可以没有它们。但如果你确实依赖他们,请记住,之后会有更多的工作要做。