Php 自制安装的两个版本的icu4c

Php 自制安装的两个版本的icu4c,php,node.js,macos,homebrew,icu4c,Php,Node.js,Macos,Homebrew,Icu4c,每当我试图在Mac上运行npm--version或node--version时,我都会遇到以下错误: $> node --version dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib Referenced from: /usr/local/bin/node Reason: image not found Abort trap: 6 我找到了建议链接适当版本的方法,并通过以下方法解决了我

每当我试图在Mac上运行
npm--version
node--version
时,我都会遇到以下错误:

$> node --version
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
Abort trap: 6
我找到了建议链接适当版本的方法,并通过以下方法解决了我的问题:

$> brew switch icu4c 63.1
Cleaning /usr/local/Cellar/icu4c/64.2
Cleaning /usr/local/Cellar/icu4c/63.1
Opt link created for /usr/local/Cellar/icu4c/63.1
$> brew switch icu4c 64.2
Cleaning /usr/local/Cellar/icu4c/64.2
Cleaning /usr/local/Cellar/icu4c/63.1
Opt link created for /usr/local/Cellar/icu4c/64.2
但是,执行此操作后,PHP停止工作:

$> tail /usr/local/var/log/php-fpm.log
  Reason: image not found
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/php/sbin/php-fpm
  Reason: image not found
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/php/sbin/php-fpm
  Reason: image not found
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/php/sbin/php-fpm
  Reason: image not found
我找到了建议链接适当版本的方法,并通过以下方法解决了我的问题:

$> brew switch icu4c 63.1
Cleaning /usr/local/Cellar/icu4c/64.2
Cleaning /usr/local/Cellar/icu4c/63.1
Opt link created for /usr/local/Cellar/icu4c/63.1
$> brew switch icu4c 64.2
Cleaning /usr/local/Cellar/icu4c/64.2
Cleaning /usr/local/Cellar/icu4c/63.1
Opt link created for /usr/local/Cellar/icu4c/64.2

但是现在NodeJS又坏了!我如何告诉Homebrew创建两个链接,一个用于63.1,一个用于64.2?或者有没有办法告诉NodeJS改用较新的64.2?

去掉brew的节点、npm等

然后像这样在您的用户帐户中安装nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
安装后,安装梦想节点(例如)

它将安装LTS版本12及其npm

您还可以安装多个节点,并使用nvm轻松切换

读一读。特别是关于建立一些出口

最后,选择您选择的php


pf:我还必须解决brew与mysql冲突的问题,并从Oracle发行版安装硬mysql。

如果有办法让自制程序链接两个版本的库(它们链接到磁盘上的不同位置,因此应该是可能的)然后我仍然对解决方案感兴趣——不过我现在已经找到了解决问题的方法。我将NodeJS更新到12.6.0版,该版本使用较新的icu4c库。正在寻找一种自制的解决方案,因为其他程序也会出现这种情况。@Petah好吧,我选择做自己的事情,即不要等待苹果、brew或任何其他人来修复他们的东西。nvm的好处是,它可以通过我的管道到达我所有环境中的各种操作系统和容器。