Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two versions of icu4c installed by Homebrew

Whenever I attempted to run npm --version or node --version on my Mac, I was getting the following error:

$> 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

I found this helpful SO post which suggested linking the appropriate version, and fixed my issue with:

$> 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

However after doing this, PHP stopped working:

$> 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

I found this helpful SO post which suggested linking the appropriate version, and fixed my issue with:

$> 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

But now NodeJS is broken again! How can I tell Homebrew to create both links, one for 63.1 and one for 64.2? Or is there a way to tell NodeJS to use the newer 64.2 instead?

like image 245
stevendesu Avatar asked Jul 24 '19 16:07

stevendesu


People also ask

What is the difference between ICU and ICU4J?

ICU has a sister project ICU4J that extends the internationalization capabilities of Java to a level similar to ICU. The ICU C/C++ project is also called ICU4C when a distinction is necessary. This document describes how to build and install ICU on your machine.

What is ICU C/C++?

The ICU C/C++ project is also called ICU4C when a distinction is necessary. This document describes how to build and install ICU on your machine. For other information about ICU please see the following table of links.

What version of the ICU source code should I download?

Official Release Snapshot: If you want to use ICU (as opposed to developing it), you should download an official packaged version of the ICU source code. These versions are tested more thoroughly than day-to-day development builds of the system, and they are packaged in zip and tar files for convenient download.

Where can I find the latest release of the ICU?

See the ICU download page to find the subpage for the current release, including any other changes, bug fixes, known issues, changes to supported platforms and build environments, and migration issues for existing applications migrating from previous ICU releases.


1 Answers

Get rid of brew's node , npm, etc ...

then install nvm like so, in your user account.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash

once installed, install the node of your dreams (for example)

nvm install v12    

it will install the LTS version 12, as well as its npm.

You can also install multiple node's, and switch easily with nvm.

read about it here. Especially about setting up some exports.

Finally, chose the php of your choice.

pf : I also had to work around brew *&^%@#* for conflicts with mysql and install hard mysql from Oracle distro.

like image 77
YvesLeBorg Avatar answered Oct 19 '22 20:10

YvesLeBorg