一、背景
brew install node
命令安装node完成后,node -v
报下边错误
dyld[59644]: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.66.dylib
Referenced from: /usr/local/Cellar/node@10/10.20.1_1/bin/node
Reason: tried: '/usr/local/opt/icu4c/lib/libicui18n.66.dylib' (no such file), '/usr/local/lib/libicui18n.66.dylib' (no such file), '/usr/lib/libicui18n.66.dylib' (no such file), '/usr/local/Cellar/icu4c/69.1/lib/libicui18n.66.dylib' (no such file), '/usr/local/lib/libicui18n.66.dylib' (no such file), '/usr/lib/libicui18n.66.dylib' (no such file)
二、解决方案
> which node
/usr/local/bin/node
> rm /usr/local/bin/node
> brew unlink node
> brew link --overwrite node
三、详细过程如下
➜ ~ ✗ node -v
dyld[59644]: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.66.dylib
Referenced from: /usr/local/Cellar/node@10/10.20.1_1/bin/node
Reason: tried: '/usr/local/opt/icu4c/lib/libicui18n.66.dylib' (no such file), '/usr/local/lib/libicui18n.66.dylib' (no such file), '/usr/lib/libicui18n.66.dylib' (no such file), '/usr/local/Cellar/icu4c/69.1/lib/libicui18n.66.dylib' (no such file), '/usr/local/lib/libicui18n.66.dylib' (no such file), '/usr/lib/libicui18n.66.dylib' (no such file)
[1] 59644 abort node -v
➜ ~ ✗ which node
/usr/local/opt/node@10/bin/node
➜ ~ ✗ rm /usr/local/opt/node@10/bin/node
override r-xr-xr-x wangjianwen/staff for /usr/local/opt/node@10/bin/node? yes
➜ ~ ✗ brew unlink node
Unlinking /usr/local/Cellar/node/17.0.1... 66 symlinks removed.
➜ ~ ✗ brew link --overwrite node
Linking /usr/local/Cellar/node/17.0.1... 66 symlinks created.
➜ ~ ✗ node -v
v17.0.1
➜ ~ ✗ npm -v
6.14.4
参考资料:
https://newbedev.com/javascript-dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-67-dylib-code-example