简体   繁体   English

更新和升级Homebrew后如何修复丢失的库

[英]How to fix missing library after update and upgrade of Homebrew

I decided to update and upgrade Homebrew on a Friday afternoon (because why not) and it appears to have resulted in a missing library that's affecting my ability to run pretty much everything (PHP, Laravel Valet, Node, etc...) The error message on each is the same, so I'm hoping this is a simple fix, but I'm not sure where to begin. 我决定在星期五下午更新和升级Homebrew(因为为什么不这样做),它似乎导致缺​​少库,这影响了我运行几乎所有内容(PHP,Laravel Valet,Node等)的能力。每个消息都相同,因此我希望这是一个简单的解决方法,但是我不确定从哪里开始。

Chriss-MacBook-Pro-2:~ chris$ node --version
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
Abort trap: 6
Chriss-MacBook-Pro-2:~ chris$ valet
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Password:
Sorry, try again.
Password:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
/usr/local/bin/valet: line 54:   729 Abort trap: 6           php "$DIR/cli/valet.php" "$@"
Chriss-MacBook-Pro-2:~ chris$ php --version
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Abort trap: 6

They all appear to be looking for the library in /usr/local/opt/icu4c/lib/libicui18n.61.dylib 他们似乎都在/usr/local/opt/icu4c/lib/libicui18n.61.dylib寻找该库

** EDIT ** **编辑**

I ran the brew command suggested by Styx and here is the output: 我运行了Styx建议的brew命令,这是输出:

Chriss-MacBook-Pro-2:~ chris$  brew link icu4c
Warning: Refusing to link macOS-provided software: icu4c
If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

Adding icu4c to my path is easy enough, but I'm not sure what to do about the second part asking to me to set icu4c添加到我的路径很容易,但是我不确定第二部分要我设置怎么做

** Update ** **更新**

Here is the output from running ls -l /usr/local/opt/icu4c/lib/ 这是运行ls -l /usr/local/opt/icu4c/lib/

total 131128
drwxr-xr-x  6 chris  staff       192 Apr 17 15:42 icu
-rw-r--r--  1 chris  staff  27537504 May 31 14:04 libicudata.64.2.dylib
lrwxr-xr-x  1 chris  staff        21 Apr 17 15:42 libicudata.64.dylib -> libicudata.64.2.dylib
-r--r--r--  1 chris  staff  27532496 Apr 17 15:42 libicudata.a
lrwxr-xr-x  1 chris  staff        21 Apr 17 15:42 libicudata.dylib -> libicudata.64.2.dylib
-r--r--r--  1 chris  staff   2578452 May 31 14:04 libicui18n.64.2.dylib
lrwxr-xr-x  1 chris  staff        21 Apr 17 15:42 libicui18n.64.dylib -> libicui18n.64.2.dylib
-r--r--r--  1 chris  staff   4700120 Apr 17 15:42 libicui18n.a
lrwxr-xr-x  1 chris  staff        21 Apr 17 15:42 libicui18n.dylib -> libicui18n.64.2.dylib
-r--r--r--  1 chris  staff     61280 May 31 14:04 libicuio.64.2.dylib
lrwxr-xr-x  1 chris  staff        19 Apr 17 15:42 libicuio.64.dylib -> libicuio.64.2.dylib
-r--r--r--  1 chris  staff     68744 Apr 17 15:42 libicuio.a
lrwxr-xr-x  1 chris  staff        19 Apr 17 15:42 libicuio.dylib -> libicuio.64.2.dylib
-rw-r--r--  1 chris  staff     67124 May 31 14:04 libicutest.64.2.dylib
lrwxr-xr-x  1 chris  staff        21 Apr 17 15:42 libicutest.64.dylib -> libicutest.64.2.dylib
-r--r--r--  1 chris  staff     79432 Apr 17 15:42 libicutest.a
lrwxr-xr-x  1 chris  staff        21 Apr 17 15:42 libicutest.dylib -> libicutest.64.2.dylib
-r--r--r--  1 chris  staff    174512 May 31 14:04 libicutu.64.2.dylib
lrwxr-xr-x  1 chris  staff        19 Apr 17 15:42 libicutu.64.dylib -> libicutu.64.2.dylib
-r--r--r--  1 chris  staff    235368 Apr 17 15:42 libicutu.a
lrwxr-xr-x  1 chris  staff        19 Apr 17 15:42 libicutu.dylib -> libicutu.64.2.dylib
-rw-r--r--  1 chris  staff   1578232 May 31 14:04 libicuuc.64.2.dylib
lrwxr-xr-x  1 chris  staff        19 Apr 17 15:42 libicuuc.64.dylib -> libicuuc.64.2.dylib
-r--r--r--  1 chris  staff   2498616 Apr 17 15:42 libicuuc.a
lrwxr-xr-x  1 chris  staff        19 Apr 17 15:42 libicuuc.dylib -> libicuuc.64.2.dylib
drwxr-xr-x  5 chris  staff       160 May 31 14:04 pkgconfig

It seems your icu4c has been upgraded, but your php/node are still refer to an older version. 看来您的icu4c已升级,但您的php / node仍旧是旧版本。

You can: 您可以:

  1. Reinstall software which depends on icu4c : 重新安装依赖于icu4c软件:

     brew uses --installed icu4c | xargs brew reinstall 
  2. Switch to using older version of icu4c : 切换到使用较旧的icu4c版本:

     brew switch icu4c 61.2 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM