React-native: dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib

Created on 9 Apr 2018  Â·  27Comments  Â·  Source: facebook/react-native

I get the following error when I try to build my react native app in XCode:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found 

All of the things I've found on google talk about reinstalling node using homebrew. However, I'm not using node via Homebrew, my node is installed via nvm.

Any help would be much appreciated.

Environment

Environment:
OS: macOS High Sierra 10.13.4
Node: 9.9.0
Yarn: 1.3.2
npm: 5.7.1
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.3.1 => 16.3.1
react-native: ^0.55.1 => 0.55.1

Steps to Reproduce

This is a project which builds fine on my client's machine and my laptop. It is only not working on my desktop computer.

Expected Behavior

I thought it would build.

Actual Behavior

It doesn't build because of the above error.

Ran Commands For Stack Overflow Locked

Most helpful comment

try npm version and see if you see the same error. If so, try to upgrade your node version brew upgrade npm and

==> Upgrading 1 outdated package, with result:
npm 8.1.2 -> 10.3.0
==> Upgrading npm
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c

fixed for me.

All 27 comments


Thanks for posting this! It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out?

If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label. Thank you for your contributions.

How to Contribute • What to Expect from Maintainers

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?

Thank you for your contributions.

Yes.

I have tried completely uninstalling and reinstalling node. I have tried reinstalling icu4c manually. I have tried older versions of node, I have tried the latest version of node 9.11.1. I have updated my chown permissions. I have tried everything I could find on google related to this error. Nothing works.

This issue looks like a question that would be best asked on Stack Overflow.

Stack Overflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

Will close this as this is really a question that should be asked on Stack Overflow.

+1
same problem

try npm version and see if you see the same error. If so, try to upgrade your node version brew upgrade npm and

==> Upgrading 1 outdated package, with result:
npm 8.1.2 -> 10.3.0
==> Upgrading npm
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c

fixed for me.

I re-install yarn and upgrade my node version with nvm.
then it work again...

I have still don't know what problem happened with it...but it's work again for me.

Hey, so I solved a similar issue just now.

I was using React (not React Native) and was trying to sniff php code, but the error I got took the same form as yours:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/php
  Reason: image not found

What solved my issue was updating npm from 5.6.0 to 6.1.0 with npm i -g npm, then reinstalling php with brew reinstall [email protected].

I'd imagine that doing brew reinstall node would work for you since your error references your node install. But you aren't using homebrew... maybe as a last-ditch effort you could try installing it. I think the problem is likely with your node install though. Hope this helps and good luck!

I got a new MBP and did a migration from my old one, but was getting this error while building my app for android. Doing the following worked for me:

sudo chown -R $(whoami) /usr/local/Cellar
brew uninstall --force yarn
brew uninstall --force icu4c
brew uninstall --force node
brew install node
brew install yarn

this is the correct solution:
brew uninstall --ignore-dependencies node icu4c
brew install node
brew link --overwrite node

Make sure everything is up to date.
Update brew using brew update
Update packages using brew upgrade

Worked for me, had an issue with Laravel Valet and Composer.

Updating yarn fixed the problem for me brew upgrade yarn

I'm developing a Ruby on Rails application and found the above error. What worked for me was the following:

brew reinstall yarn

brew info icu4c
you can see something like this
/usr/local/Cellar/icu4c/63.1 or
/usr/local/Cellar/icu4c/62.1 or
/usr/local/Cellar/icu4c/56.1 or
/usr/local/Cellar/icu4c/58.1

cd /usr/local/Cellar/icu4c/58.1/lib
then
cp ./libicui18n.58.dylib /usr/local/opt/icu4c/lib/

I hope i can help you

brew update && brew upgrade worked for me. Dependency hell is fun.

Dear future person searching to fix this problem. brew update & brew upgrade worked for me too!! Haha

@renxinqiang Thanks! Worked like a charm.

brew cleanup

brew update && brew upgrade worked for me

I got a new MBP and did a migration from my old one, but was getting this error while building my app for android. Doing the following worked for me:

sudo chown -R $(whoami) /usr/local/Cellar
brew uninstall --force yarn
brew uninstall --force icu4c
brew uninstall --force node
brew install node
brew install yarn

This worked for me except I had to do
sudo chown -R $(whoami) /usr/local/Cellar /usr/local/etc /usr/local/lib

brew update && brew upgrade FTW

brew update && brew upgrade

didn´t fix for me

ANDROID_HOME=/Users/danielswiatek/Library/Android/sdk
JAVA_HOME=/Library/Java/Home
No emulator specified, defaulting to Pixel_2_API_28
Waiting for emulator to start...
dyld: Library not loaded: /tmp/ssh-build-qt/build/install-darwin-x86_64/lib/libQt5Widgets.5.dylib
Referenced from: /usr/local/bin/emulator64-x86
Reason: image not found

Downgrading icu4c to v62.1 worked for me. I followed instructions from this answer: https://stackoverflow.com/a/54273234/7456872

brew info icu4c
you can see something like this
/usr/local/Cellar/icu4c/63.1 or
/usr/local/Cellar/icu4c/62.1 or
/usr/local/Cellar/icu4c/56.1 or
/usr/local/Cellar/icu4c/58.1

cd /usr/local/Cellar/icu4c/58.1/lib
then
cp ./libicui18n.58.dylib /usr/local/opt/icu4c/lib/

I hope i can help you

This worked for me.
cp /usr/local/Cellar/icu4c/63.1/lib/*.dylib /usr/local/opt/icu4c/lib/

brew cleanup and/or brew reinstall php7.2 seems to have done it for me. I also did brew update && brew upgrade and reinstalled yarn and all that before that.

This worked for me!

$ brew switch icu4c 63.1

Cleaning /usr/local/Cellar/icu4c/63.1
Opt link created for /usr/local/Cellar/icu4c/63.1
Was this page helpful?
0 / 5 - 0 ratings

Related issues

axelg12 picture axelg12  Â·  3Comments

phongyewtong picture phongyewtong  Â·  3Comments

grabbou picture grabbou  Â·  3Comments

aniss picture aniss  Â·  3Comments

ghost picture ghost  Â·  3Comments