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

React项目安装失败求助:Yarn网络连接错误排查

Troubleshooting Your Yarn React Installation Failure

Hey there! Let's break down why your React project setup with Yarn is hitting a wall. From the error logs you shared, the core issue is obvious: Yarn is trying to use a local proxy (127.0.0.1:80) that it can't connect to, which is blocking it from pulling React packages from the registry.

Here's a step-by-step fix guide to get you back on track:

Step 1: Check and Clear Yarn's Proxy Configurations

First, let's confirm if Yarn has misconfigured proxy settings causing the problem:

  • Run these commands in your terminal to check current proxy configs:
    yarn config get proxy
    yarn config get https-proxy
    
  • If either command returns http://127.0.0.1:80 or any unexpected proxy address, delete those settings right away:
    yarn config delete proxy
    yarn config delete https-proxy
    

Step 2: Verify System-Level Proxy Settings

Yarn automatically inherits proxy settings from your operating system. If you've set up a system-wide proxy (like in Windows' Internet Options or macOS's Network settings):

  • Temporarily disable the proxy to rule out connectivity issues.
  • If you need the proxy active, double-check that the proxy address and port are correct, and the proxy service is actually running.

Even if proxy issues are fixed, connecting to the official Yarn registry can be slow from some regions. Switching to a domestic mirror can prevent future network-related failures:

yarn config set registry https://registry.npmmirror.com

Step 4: Re-Run the Installation Command

After completing the above steps, try running your original install command again:

yarn add --exact react react-dom react-scripts cra-template --cwd D:\React\resort

Extra Checks If the Problem Persists

  • Firewall/Antivirus Interference: Some security software might block Yarn's network requests. Temporarily disable your firewall or antivirus and try again to see if that's the culprit.
  • Port 80 Occupancy: The error mentions a connection refused on port 80. Use netstat -ano | findstr ":80" on Windows to check if another program is using this port, and stop that program if needed.
  • Dig Into the Error Log: The yarn-error.log file at D:\React\resort\yarn-error.log might have more detailed clues if the above steps don't resolve the issue.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.08 14:57:41