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

使用npx create-react-app创建React应用时遇ENOTFOUND错误求助

解决npx create-react-app网络连接错误(ENOTFOUND)

针对你遇到的ENOTFOUND网络错误,以下是可行的解决步骤:

  • 检查并清除npm代理配置
    首先确认是否存在错误的代理设置:

    npm config get proxy
    npm config get https-proxy
    

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

    npm config delete proxy
    npm config delete https-proxy
    

    或者直接重置代理为null:

    npm config set proxy null
    npm config set https-proxy null
    
  • 切换npm镜像源
    国外npm源可能存在访问问题,切换为国内镜像(如淘宝镜像):

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

    验证镜像是否生效:

    npm config get registry
    

    返回https://registry.npmmirror.com/即为设置成功。

  • 清除npm缓存
    缓存损坏也可能导致连接问题,强制清除缓存:

    npm cache clean --force
    

    也可以手动删除缓存目录:C:\Users\pc\AppData\Local\npm-cache(对应错误日志中的路径)

  • 重启终端与网络
    关闭当前PowerShell窗口,重新打开管理员权限的终端;同时尝试刷新网络(如重启路由器或切换网络环境)。

  • 指定版本执行命令
    如果上述方法无效,尝试直接指定最新版本的create-react-app:

    npx create-react-app@latest react-app --use-npm
    
  • 检查系统DNS设置
    若仍无法连接,可尝试修改系统DNS为公共DNS,比如8.8.8.8(谷歌)或114.114.114.114(国内)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.04 00:25:53