Mac安装Reveal.js失败求助:执行npm install遇依赖库缺失问题
问题
按照Reveal.js官方文档进行完整安装,执行第三步命令cd reveal.js && npm install时失败,报错信息如下:
Library not loaded: /opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib Referenced from: <E75B5D55-A56F-38D1-828D-ACC88DC8B337> /opt/homebrew/Cellar/node/22.2.0/bin/node Reason: tried: '/opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib' (no such file), '/opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib' (no such file), '/opt/homebrew/Cellar/icu4c@76/76.1_1/lib/libicui18n.74.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/icu4c@76/76.1_1/lib/libicui18n.74.dylib' (no such file), '/opt/homebrew/Cellar/icu4c@76/76.1_1/lib/libicui18n.74.dylib' (no such file) zsh: abort npm install
解决方案
该错误是Node.js 22.2.0依赖的icu4c 74版本已被Homebrew更新至76版本,导致动态库匹配失败,可按以下步骤修复:
- 重新安装Node.js,让其关联当前系统的icu4c版本:
brew reinstall node - 若上述命令无效,卸载后重新安装Node.js:
brew uninstall node brew install node - 若问题仍存在,清理Homebrew缓存后再安装:
brew cleanup -s brew uninstall node brew install node - 验证修复:执行
node -v确认Node可正常启动,再回到reveal.js目录重新运行npm install
内容的提问来源于stack exchange,提问作者user14381362
相关产品推荐
相关产品推荐

