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

React项目执行yarn安装依赖时遇connect ECONNREFUSED错误求助

解决yarn install时connect ECONNREFUSED错误

报错信息

yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.npmjs.org/@babel%2fhelper-builder-react-jsx: connect ECONNREFUSED 104.16.23.35:443".
info If you think this is a bug, please open a bug report with the information provided in "/media/bkroland19/ROLAND/FINAL/ElectionDapp-main/client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

解决步骤

  • 检查网络连通性:尝试访问https://registry.npmjs.org/@babel/helper-builder-react-jsx,或者ping 104.16.23.35,确认网络能正常连接npm官方源。如果无法访问,排查防火墙、路由器限制或网络运营商问题。
  • 切换国内镜像源:执行以下命令将yarn registry替换为国内镜像,解决官方源访问不畅的问题:
    yarn config set registry https://registry.npmmirror.com
    
    之后重新运行yarn install。
  • 清理代理配置:若之前设置过代理,可能代理失效导致连接失败。先查看当前代理设置:
    yarn config get proxy
    yarn config get https-proxy
    
    若存在无效代理,执行以下命令清空:
    yarn config delete proxy
    yarn config delete https-proxy
    
  • 重置yarn配置:如果配置文件出现异常,执行重置命令恢复默认设置:
    yarn config reset
    
  • 检查本地安全软件:临时关闭防火墙、杀毒软件等,确认是否是这类软件阻止了yarn的网络请求。

内容的提问来源于stack exchange,提问作者Bukenya KizzaRoland

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 04:15:18