You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac M1 Sonoma执行node -v报错,重装Node/icu4c无效求助

解决方案:Mac M1 Sonoma下Node@14依赖icu4c版本不兼容问题

方法1:安装指定版本icu4c并建立软链接

  • 卸载当前不兼容的icu4c版本:
    brew uninstall --ignore-dependencies icu4c
    
  • 安装Node@14依赖的73.x版本icu4c:
    brew install icu4c@73
    
  • 创建软链接让Node找到对应库文件:
    ln -s /opt/homebrew/Cellar/icu4c@73/73.2/lib/libicui18n.73.dylib /opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib
    ln -s /opt/homebrew/Cellar/icu4c@73/73.2/lib/libicuuc.73.dylib /opt/homebrew/opt/icu4c/lib/libicuuc.73.dylib
    ln -s /opt/homebrew/Cellar/icu4c@73/73.2/lib/libicudata.73.dylib /opt/homebrew/opt/icu4c/lib/libicudata.73.dylib
    
  • 执行node -v验证是否恢复正常

方法2:用asdf管理Node版本(长期稳定方案)

适合需要频繁切换Node版本的场景,彻底规避依赖冲突:

  • 安装asdf版本管理器:
    brew install asdf
    
  • 添加Node.js插件:
    asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
    
  • 安装指定版本的Node@14:
    asdf install nodejs 14.21.3
    
  • 设置全局或当前目录使用该版本:
    # 全局生效
    asdf global nodejs 14.21.3
    # 仅当前目录生效
    asdf local nodejs 14.21.3
    
  • 执行node -v确认版本正常

方法3:手动重新编译Node@14(进阶方案)

如果前两种方法无效,可手动编译适配当前icu4c版本:

  • 下载Node@14.21.3源码包:
    curl -O https://nodejs.org/dist/v14.21.3/node-v14.21.3.tar.gz
    tar -xzf node-v14.21.3.tar.gz
    cd node-v14.21.3
    
  • 配置编译参数指定当前icu4c路径:
    ./configure --with-icu-dir=/opt/homebrew/opt/icu4c
    
  • 编译并安装:
    make -j8
    sudo make install
    
  • 执行node -v检查运行状态

内容的提问来源于stack exchange,提问作者Robert Hu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 06:42:13