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,或者ping104.16.23.35,确认网络能正常连接npm官方源。如果无法访问,排查防火墙、路由器限制或网络运营商问题。 - 切换国内镜像源:执行以下命令将yarn registry替换为国内镜像,解决官方源访问不畅的问题:
之后重新运行yarn config set registry https://registry.npmmirror.comyarn install。 - 清理代理配置:若之前设置过代理,可能代理失效导致连接失败。先查看当前代理设置:
若存在无效代理,执行以下命令清空:yarn config get proxy yarn config get https-proxyyarn config delete proxy yarn config delete https-proxy - 重置yarn配置:如果配置文件出现异常,执行重置命令恢复默认设置:
yarn config reset - 检查本地安全软件:临时关闭防火墙、杀毒软件等,确认是否是这类软件阻止了yarn的网络请求。
内容的提问来源于stack exchange,提问作者Bukenya KizzaRoland
相关产品推荐
相关产品推荐

