Installing node with brew fails on Mac OS Sierra

node.jsHomebrew

node.js Problem Overview


I'm trying to install node with homebrew on macOS Sierra. I run

 brew install node

After a seemingly successful install I get the following when trying to run node:

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

node.js Solutions


Solution 1 - node.js

This is the series of incantations that eventually worked for me based on this link suggested by @robertklep and @vovkasm.

brew uninstall --force node
brew uninstall icu4c && brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node

I'm not sure if they're all needed, but given that I can't get my machine in the previous state... I'll just leave this info here, maybe it'll be useful for somebody else.

Solution 2 - node.js

In my case, brew upgrade node resolve the problem :)

Solution 3 - node.js

Well I got this error trying to install @angular/cli, realized node might be out of date. Following @mircealungu 's exact steps didn't quite work for me, here is the modified version that worked for me.

brew uninstall --ignore-dependencies --force node
brew uninstall --ignore-dependencies --force icu4c
brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node

Solution 4 - node.js

Upgrading node fixed a problem.

brew upgrade node 

Solution 5 - node.js

I recently encountered a similar issue (after doing brew switch node 9.8.0 to downgrade to a previous version of node)

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

The issue is that node is picky about which version of icu4c it's looking for, and the version I had installed (62) was higher than node was expecting.

To fix, I made sure I had version 60 of icu4c selected.

First I found which versions I had with brew info icu4c, then did brew switch icu4c 60.2 to select the one node was expecting.

Solution 6 - node.js

For me it was apparently a problem with the icu4c installation from brew.

brew reinstall icu4c

will reinstall icu4c.

if you don't have it installed,

brew install icu4c

Solution 7 - node.js

Seems file /usr/local/opt/icu4c/lib/libicui18n.58.dylib does not exists in you system.

Please ensure that icu4c installed with Homebrew.

  1. brew info icu4c
  2. If already installed, try reinstall: brew reinstall icu4c
  3. If not installed, try install: brew install icu4c

Solution 8 - node.js

For high seirra, just "brew upgrade" makes magic!

Solution 9 - node.js

First I uninstall node and icu4c, force to uninstall all versions

brew uninstall --force --ignore-dependencies node icu4c

After install version 8 of Node

brew install node@8

If it already install, please just upgrade

brew upgrade node@8

And enter

node -v

v8.11.1

Solution 10 - node.js

This was triggered for me after a brew upgrade and brew update ran. I was able to fix it by simply re-installing the two items flagged as problems (which made sense to me):

brew reinstall node
brew reinstall icu4c

Solution 11 - node.js

None of the above worked for me. I'm using High Sierra.

What fixed it for me was brew upgrade

Solution 12 - node.js

I found a solution that works great over here. I'll briefly give the commands below.

First, cd into the homebrew formula directory:

cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula

Git log:

git log --follow icu4c.rb

Choose the commit hash that matches the version you need. I needed version 61.1, thus chose the 6d9815 commit:

git checkout -b icu4c-61.1 6d9815

Reinstall:

brew reinstall ./icu4c.rb

Switch:

brew switch icu4c 61.1

That fixed it for me.

Credit: hanxue

Solution 13 - node.js

Nothing worked for me but running this worked

brew link --overwrite node

Solution 14 - node.js

brew uninstall --force node
brew uninstall --ignore-dependencies icu4c
brew unlink icu4c && brew link icu4c --force
brew install node

Solution 15 - node.js

This error was given to me after migrating machines.

Even though everything was installed, when I went to check node -v or npm version, I'd get this error.

What fixed it was brew reinstall icu4c.

Solution 16 - node.js

I had the same problem with my local php installation.

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Abort trap: 6

Solved the problem with this command. (check your version)

brew link --overwrite --force php@7.1

Solution 17 - node.js

I removed export PATH="/usr/local/opt/icu4c/bin:$PATH" from my ~/.bash_profile file and it fixed my problem.

My error was:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
  Referenced from: /usr/local/opt/node@10/bin/node
  Reason: image not found
Abort trap: 6

My /usr/local/opt/icu4c/lib contains libicui18n.64.dylib

Solution 18 - node.js

I fixed by

cd /usr/local/Cellar
rm -rf node*/
rm -rf icu4c/
brew install node

Solution 19 - node.js

it seems like your icu4u Reference path is not set properly

first check you might instal icu4c or not by putting below comment in comment promt

brew info icu4c

or else reinstall

brew reinstall icu4c

If you need to have this software first in your PATH run:

echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile

hope This might help !!!!!

Solution 20 - node.js

It's as easy as a common software, just download installation package from official site:NodeJS

and then download a recommended version(currently 8.11.3, end with .pkg), install it as a common software, then u can use it. I tried so many methods, and only this works for me.

Solution 21 - node.js

Try restarting your machine. That helped me.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmircealunguView Question on Stackoverflow
Solution 1 - node.jsmircealunguView Answer on Stackoverflow
Solution 2 - node.jsice6View Answer on Stackoverflow
Solution 3 - node.jsishandutta2007View Answer on Stackoverflow
Solution 4 - node.jsmkkrolikView Answer on Stackoverflow
Solution 5 - node.jsamcvittyView Answer on Stackoverflow
Solution 6 - node.jsddavisonView Answer on Stackoverflow
Solution 7 - node.jsuser2266462View Answer on Stackoverflow
Solution 8 - node.jsBasavaraj HadimaniView Answer on Stackoverflow
Solution 9 - node.jsRenan BronchartView Answer on Stackoverflow
Solution 10 - node.jsKevin LearyView Answer on Stackoverflow
Solution 11 - node.jsmarkashworthView Answer on Stackoverflow
Solution 12 - node.jsSawantView Answer on Stackoverflow
Solution 13 - node.jsharsh zalavadiyaView Answer on Stackoverflow
Solution 14 - node.jsrapaelecView Answer on Stackoverflow
Solution 15 - node.jsMichaelView Answer on Stackoverflow
Solution 16 - node.jsFredView Answer on Stackoverflow
Solution 17 - node.jsy2knoproblemView Answer on Stackoverflow
Solution 18 - node.jsMiao1007View Answer on Stackoverflow
Solution 19 - node.jssritharanView Answer on Stackoverflow
Solution 20 - node.jsLau RealView Answer on Stackoverflow
Solution 21 - node.jsVygandasView Answer on Stackoverflow