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

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.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 27

Most upvoted comments

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.

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

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/php@7.1/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 php@7.1.

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!

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.

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.

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

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

+1 same problem

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

Updating yarn fixed the problem for me brew upgrade yarn

brew update && brew upgrade worked for me

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

brew reinstall yarn

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

brew update && brew upgrade FTW

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.