在 MacOSSierra 上使用 brew 安装节点失败

我想在 MacOS Sierra 上安装自制程序的节点。 我跑步

 brew install node

在一次看似成功的安装之后,我在尝试运行 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
65330 次浏览

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

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.

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

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

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

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

Upgrading node fixed a problem.

brew upgrade node

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

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

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.

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.

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

What fixed it for me was brew upgrade

Nothing worked for me but running this worked

brew link --overwrite node

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.

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

Try restarting your machine. That helped me.

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

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

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

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

I fixed by

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

i run this on macos:

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

it takes around 20 minu