44

For my case, i only get the error when opening accessing terminal (zsh) via VS Code.

Upon opening VS Code terminal OR running node command, i get this error:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
[1]    4506 abort      node

However, it runs fine when running via iTerm. Tried running brew update and brew upgrade and a few other recommended answers.

Anything am i missing?

jaanhio
  • 773
  • 1
  • 7
  • 18
  • New install of VS code and new macbook - same issue. macOS Mojave and VS 1.31.0 – Jason Feb 13 '19 at 04:12
  • [2020 answer] Here is the related issue answer: https://stackoverflow.com/a/63955091/7059946 – mialdi98 Sep 18 '20 at 14:07
  • 2 years 6 months later, i encountered this problem again and am glad that @Jason's answer (https://stackoverflow.com/a/54662431/8096221) helped me resolve this again – jaanhio Aug 29 '21 at 01:41
  • Again the same issue. I've migrated to Apple M1, and some folders seem messed up. [This answer](https://stackoverflow.com/a/69702082/1779739) helped me to resolve the problem. ```shell rm -rf /usr/local/bin/npm && rm -rf /usr/local/bin/node ``` – Vitalii Kyrychenko Aug 14 '23 at 08:44

5 Answers5

44

Piggybacking off Jason's answer, another option is to just run

brew upgrade node
ihake
  • 1,741
  • 1
  • 17
  • 29
  • 2
    Work! 10.14.6 macOS – falselight Oct 23 '19 at 17:48
  • I got this error, but this answer still worked for me (solved the problem despite the error message) `Error: No such file or directory - /usr/local/Cellar/yarn/1.12.3` – stevec Feb 26 '20 at 04:45
  • Yes! Thank you! I had already run `brew upgrade` and `brew cleanup` (or whatever it is) and was panicking! – Liz Dec 17 '20 at 05:09
34

Found the answer here

Run this

brew uninstall node icu4c
brew install node
Jason
  • 15,064
  • 15
  • 65
  • 105
  • 3
    Found the answer here--thanks! `brew uninstall --ignore-dependencies node icu4c` avoided issues with several related dependencies, including postgresql. – SexxLuthor Apr 25 '19 at 05:12
  • I ran into this issue after upgrading from Mojave to Monterey (although it was /usr/local/opt/icu4c/lib/libicui18n.70.dylib). In addition to the answers here I somehow had a bad Node install lying around and had to `rm -rf /usr/local/Cellar/node\@12` then `brew install node` and now things are back to normal. – Nathaniel Heinrichs Feb 17 '23 at 09:40
22

You might follow these steps.

> which node
/usr/local/bin/node
> rm /usr/local/bin/node
> brew unlink node
> brew link --overwrite node

This should solve the problem.

Rakesh K
  • 1,290
  • 1
  • 16
  • 43
11

A brew reinstall icu4c fixed the problem on macOS 10.15.6.

It also helps to watch your logs when starting a broken package (node, pg, etc. – for pg it's tail -f /usr/local/var/log/postgresql@11.log – not the server log).

medik
  • 1,174
  • 12
  • 17
0

I had to reinstall VSCode using the apple silicon download link here. If I installed the from the command line it kept using the old /usr/bin folders instead of the new M1 brew folder /opt/homebrew

ohthepain
  • 2,004
  • 3
  • 19
  • 30