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

为何使用npm创建React App失败?报ECONNRESET错误求协助

解决npx create-react-app 安装时出现ECONNRESET网络错误

根据你提供的错误信息,这是典型的网络连接问题,以下是具体的解决步骤:

  • 清理npm代理设置
    先检查当前是否配置了代理:

    npm config get proxy
    npm config get https-proxy
    

    如果返回非空值,执行以下命令清空代理:

    npm config delete proxy
    npm config delete https-proxy
    
  • 切换npm镜像源为国内源
    国内网络访问官方npm源可能不稳定,切换到淘宝镜像源:

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

    验证镜像源是否生效:

    npm config get registry
    
  • 清除npm缓存
    清理可能存在的缓存问题:

    npm cache clean --force
    
  • 重新创建React应用
    执行原命令重试,或者直接指定镜像源运行:

    npx create-react-app my-app
    # 或者指定镜像源
    npx --registry=https://registry.npmmirror.com create-react-app my-app
    
  • 检查网络环境
    确认本地网络稳定,若处于企业内网,需确认是否有防火墙或代理规则限制了npm的网络请求。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.10 05:30:52