最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【已解决】Mac中npm install canvas报错:dyld Library not loaded icu4c libicui18n.64.dylib Referenced from [email protected] node

node crifan 827浏览 0评论
折腾:
【未解决】gitbook安装和使用插件autocover给生成的pdf文件加上封面
期间,去安装canvas:
 npm install -g canvas
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/node
  Reason: image not found
[1]    95770 abort      npm install -g canvas
试了多次,问题依旧。
难道是正在更新brew导致的?
好像不像啊
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib [email protected]/bin/node
node.js – dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac – Stack Overflow
那还是等会,等
【未解决】Mac中brew install报错:Error homebrew-core is a shallow clone
彻底弄好后,再去:
brew upgrade
brew upgrade icu4c
或:
brew info icu4c
brew switch icu4c 63.1
node.js – dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib in VSCode Terminal – Stack Overflow
打算试试:
brew uninstall node icu4c
brew install node
算了,不直接删除node。否则怕影响后续nodejs的版本和已安装插件的使用。
【已解决】Mac中brew install报错:Error homebrew-core is a shallow clone
然后继续:
 npm install -g canvas
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/node
  Reason: image not found
[1]    1986 abort      npm install -g canvas
问题依旧。
试试
 brew upgrade     
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 4 casks.


==> Upgrading 30 outdated packages:
pyenv 1.2.14_1 -> 1.2.22
libimobiledevice HEAD-3d8d13f_6 -> HEAD-3d8d13f
libtool 2.4.6_1 -> 2.4.6_2
wget 1.20.3_1 -> 1.21
mongodb/brew/mongodb-community 4.2.1 -> 4.4.3
libidn2 2.2.0_1 -> 2.3.0
libplist 2.1.0 -> 2.2.0
little-cms2 2.9 -> 2.11
cmake 3.16.2 -> 3.19.3
p7zip 16.02_2 -> 16.02_3
openjpeg 2.3.1 -> 2.4.0
zeromq 4.3.2 -> 4.3.4
lz4 1.9.2 -> 1.9.3
carthage 0.34.0 -> 0.36.1
libarchive 3.4.3 -> 3.5.1_1
tesseract 4.1.0 -> 4.1.1
webp 1.0.3 -> 1.1.0
lua 5.3.5_1 -> 5.4.2
ideviceinstaller 1.1.0_4 -> 1.1.1
libusbmuxd 2.0.1 -> 2.0.2
zstd 1.4.5 -> 1.4.8
leptonica 1.78.0_1 -> 1.80.0
cloc 1.84 -> 1.88
winetricks 20191224 -> 20201206
libomp 10.0.0 -> 11.0.1
libzip 1.6.1 -> 1.7.3
libusb 1.0.23 -> 1.0.24
rpm 4.15.1_1 -> 4.16.1.2
protobuf 3.11.2 -> 3.14.0
automake 1.16.1_1 -> 1.16.3
。。。
会更新很多库。
不过没icu4c
操作完毕了
再去:
brew upgrade icu4c
结果:
 brew upgrade icu4c
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 3 casks.


Warning: icu4c 67.1 already installed
再去试试:
npm install -g canvas
问题依旧。
brew cleanup
果然有:
 brew cleanup
Removing: /usr/local/Cellar/icu4c/64.2... (257 files, 69.2MB)
Removing: /usr/local/Cellar/jpeg/9c... (21 files, 733.4KB)
Removing: /usr/local/Cellar/libtiff/4.1.0... (247 files, 3.6MB)
icu4c/64.2被清理掉了。
再去试试,问题依旧。
 brew info icu4c
icu4c: stable 67.1 (bottled) [keg-only]
C/C++ and Java libraries for Unicode and globalization
http://site.icu-project.org/home
/usr/local/Cellar/icu4c/67.1 (258 files, 71MB)
  Poured from bottle on 2021-01-18 at 14:49:01
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/icu4c.rb
License: ICU
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).


If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc


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"


For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"


==> Analytics
install: 264,096 (30 days), 962,155 (90 days), 4,479,772 (365 days)
install-on-request: 5,459 (30 days), 20,353 (90 days), 128,787 (365 days)
build-error: 0 (30 days)
和:
 brew switch icu4c 67.1
Error: Calling `brew switch` is disabled! Use `brew link` @-versioned formulae instead.
然后:
●  brew link icu4c-67.1  
Error: No such keg: /usr/local/Cellar/icu4c-67.1
去搜:
brew icu4c.rb
homebrew-core/icu4c.rb at master · Homebrew/homebrew-core
icu4c github
unicode-org/icu: The new home of the ICU project source code.
icu/icu4c at master · unicode-org/icu
无法直接打开:
https://raw.githubusercontent.com/Homebrew/homebrew-core/
icu4c github  Formula/icu4c.rb
homebrew/icu4c.rb at master · hjdivad/homebrew
homebrew/icu4c.rb at master · SirVer/homebrew
icu4c.rb
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/icu4c.rb
homebrew-core/icu4c.rb at master · Homebrew/homebrew-core
->点击Raw
 brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/icu4c.rb
Traceback (most recent call last):
'brew extract' or 'brew create' and 'brew tap-new' to create a formula file in a tap on GitHub instead.: Invalid usage: Non-checksummed download of icu4c formula file from an arbitrary URL is unsupported!  (UsageError)
'brew extract' or 'brew create' and 'brew tap-new' to create a formula file in a tap on GitHub instead.: Invalid usage: Non-checksummed download of icu4c formula file from an arbitrary URL is unsupported!  (UsageError)
此处实在找不到,此处的
icu4c的67.1所对应的
算了,随便试试其旧版本:
brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
结果:
  brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
Traceback (most recent call last):
        9: from /usr/local/Homebrew/Library/Homebrew/brew.rb:122:in `<main>'
        8: from /usr/local/Homebrew/Library/Homebrew/cmd/reinstall.rb:84:in `reinstall'
        7: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:289:in `parse'
        6: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:564:in `formulae'
        5: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:564:in `map'
        4: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:568:in `block in formulae'
        3: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:351:in `factory'
        2: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:138:in `get_formula'
        1: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:142:in `klass'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:227:in `load_file': Invalid usage: Installation of icu4c from a GitHub commit URL is unsupported! 'brew extract icu4c' to stable tap on GitHub instead. (UsageError)
        12: from /usr/local/Homebrew/Library/Homebrew/brew.rb:153:in `<main>'
        11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:155:in `rescue in <main>'
        10: from /usr/local/Homebrew/Library/Homebrew/help.rb:64:in `help'
         9: from /usr/local/Homebrew/Library/Homebrew/help.rb:83:in `command_help'
         8: from /usr/local/Homebrew/Library/Homebrew/help.rb:103:in `parser_help'
         7: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:289:in `parse'
         6: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:564:in `formulae'
         5: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:564:in `map'
         4: from /usr/local/Homebrew/Library/Homebrew/cli/parser.rb:568:in `block in formulae'
         3: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:351:in `factory'
         2: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:138:in `get_formula'
         1: from /usr/local/Homebrew/Library/Homebrew/formulary.rb:142:in `klass'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:227:in `load_file': Invalid usage: Installation of icu4c from a GitHub commit URL is unsupported! 'brew extract icu4c' to stable tap on GitHub instead. (UsageError)
算了,试试:
brew upgrade node
出错:
 brew upgrade node
Updating Homebrew...
Error: node not installed
Referenced from: /usr/local/opt/[email protected]/bin/node
Installing node.js with package installer – dyld:Library not loaded error – Stack Overflow
算了,去:
brew install node
问题依旧。
npm version
同样问题:
 npm version        
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/node
  Reason: image not found
[1]    20163 abort      npm version
然后去:
brew upgrade npm
输出:
 brew upgrade npm
Updating Homebrew...
Warning: npm 15.6.0 already installed
问题依旧。
 brew info icu4c
icu4c: stable 67.1 (bottled) [keg-only]
C/C++ and Java libraries for Unicode and globalization
http://site.icu-project.org/home
/usr/local/Cellar/icu4c/67.1 (258 files, 71MB)
。。。
 cd /usr/local/Cellar/icu4c/67.1
 [email protected]  /usr/local/Cellar/icu4c/67.1  ll
total 248
-rw-r--r--   1 xxx  CORP\Domain Users   754B  1 18 14:49 INSTALL_RECEIPT.json
-rw-r--r--   1 xxx  CORP\Domain Users    21K  4 23  2020 LICENSE
drwxr-xr-x  13 xxx  CORP\Domain Users   416B  1 18 14:49 bin
drwxr-xr-x   3 xxx  CORP\Domain Users    96B  4 23  2020 include
drwxr-xr-x  28 xxx  CORP\Domain Users   896B  4 23  2020 lib
-rw-r--r--   1 xxx  CORP\Domain Users   622B  4 23  2020 license.html
-rw-r--r--   1 xxx  CORP\Domain Users    88K  4 23  2020 readme.html
drwxr-xr-x   8 xxx  CORP\Domain Users   256B  4 23  2020 sbin
drwxr-xr-x   4 xxx  CORP\Domain Users   128B  4 23  2020 share
 [email protected]  /usr/local/Cellar/icu4c/67.1  cp ./lib/libicui18n.64.dylib /usr/local/opt/icu4c/lib/
cp: ./lib/libicui18n.64.dylib: No such file or directory
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib
[email protected]  /usr/local/Cellar/icu4c/67.1  brew uninstall --ignore-dependencies node icu4c
Uninstalling /usr/local/Cellar/node/15.6.0... (3,292 files, 55.8MB)
Uninstalling /usr/local/Cellar/icu4c/67.1... (258 files, 71MB)
 [email protected]  /usr/local/Cellar/icu4c/67.1  brew install node
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Error: The current working directory doesn't exist, cannot proceed.
退出目录再试
 brew install node
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/icu4c-67.1.mojave.bottle.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/16dcddb20c1b76530bab520d98c87e7564c1d4badeb3113548d362edd5097b62--icu4c-67.1.mojave.bottle.tar.gz
==> Downloading https://homebrew.bintray.com/bottles/node-15.6.0.mojave.bottle.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/7f9fa241f4e09eff5ffa2a5ffe69b6851a1eb6c3df71335550b30f9b37c9353b--node-15.6.0.mojave.bottle.tar.gz
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c
==> Pouring icu4c-67.1.mojave.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).


If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc


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"


For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"


==> Summary
🍺  /usr/local/Cellar/icu4c/67.1: 258 files, 71MB
==> Installing node
==> Pouring node-15.6.0.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/node/15.6.0: 3,292 files, 55.8MB
==> No outdated dependents to upgrade!
==> Checking for dependents of upgraded formulae...
==> Reinstalling 1 broken dependent from source:
[email protected]
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula with the name "[email protected]" (dependency of [email protected]).
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
可以看到期间有安装icu4c
问题依旧:
 npm install -g canvas          dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/node
  Reason: image not found
[1]    22594 abort      npm install -g canvas
重启VSCode终端,问题依旧。
 brew uninstall --ignore-dependencies [email protected] icu4c
Uninstalling /usr/local/Cellar/[email protected]/8.17.0... (3,969 files, 48.4MB)
Uninstalling /usr/local/Cellar/icu4c/67.1... (258 files, 71MB)
 brew install [email protected]
Updating Homebrew...
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "[email protected]".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
问题依旧。
 brew upgrade node
Updating Homebrew...
Warning: node 15.6.0 already installed
问题依旧。
 brew uninstall --force icu4c
 ls /usr/local/Cellar/icu4c
ls: /usr/local/Cellar/icu4c: No such file or directory
 brew install icu4c          
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/icu4c-67.1.mojave.bottle.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/16dcddb20c1b76530bab520d98c87e7564c1d4badeb3113548d362edd5097b62--icu4c-67.1.mojave.bottle.tar.gz
==> Pouring icu4c-67.1.mojave.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).


If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc


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"


For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"


==> Summary
🍺  /usr/local/Cellar/icu4c/67.1: 258 files, 71MB
 ls /usr/local/Cellar/icu4c
67.1
 brew reinstall npm
==> Downloading https://homebrew.bintray.com/bottles/node-15.6.0.mojave.bottle.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/7f9fa241f4e09eff5ffa2a5ffe69b6851a1eb6c3df71335550b30f9b37c9353b--node-15.6.0.mojave.bottle.tar.gz
==> Reinstalling node 
==> Pouring node-15.6.0.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/node/15.6.0: 3,292 files, 55.8MB
 brew info npm     
node: stable 15.6.0 (bottled), HEAD
Platform built on V8 to build network applications
https://nodejs.org/
/usr/local/Cellar/node/15.6.0 (3,292 files, 55.8MB) *
  Poured from bottle on 2021-01-18 at 17:09:30
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/node.rb
License: MIT
==> Dependencies
Build: pkg-config ✔, [email protected] ✔
Required: icu4c ✔
==> Options
--HEAD
最后成功了:
 npm install -g canvas
⸨                  ⸩ ⠙ reify:canvas: timing reifyNode:node_modules/canvas/node_modules/nan Completed in 235ms
 npm install -g canvas

added 72 packages in 38s
即可。
【总结】
此处:
npm install -g canvas
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/node
  Reason: image not found
原因:
npm(内部的node8)所依赖的icu4c,其版本(由于更新了别的而)有变动,导致报错。
解决办法:
重新安装npm:
brew reinstall npm
即可。

转载请注明:在路上 » 【已解决】Mac中npm install canvas报错:dyld Library not loaded icu4c libicui18n.64.dylib Referenced from [email protected] node

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.109 seconds, using 20.56MB memory