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

执行npx create-react-app时报npm ERR! 503 Service Unavailable错误如何解决

报错产生原因

npm返回的E503属于服务端不可用错误,触发原因是以下两种之一:

  • npm官方镜像源http://registry.npmjs.org/当时出现临时服务故障,无法响应资源下载请求
  • 本地网络到npm官方源的链路存在阻塞,比如跨境网络波动、运营商限制等,导致无法正常拉取cra-template依赖包

你当前使用的node 14.17.6、npm 6.14.15版本均符合create-react-app的运行要求,版本问题不是本次报错的诱因。

修复方案

可按以下优先级尝试修复:

  • 初始化项目时临时指定国内镜像源,无需修改全局配置,单次生效:
    npx create-react-app 你的项目名 --registry https://registry.npmmirror.com
    
  • 长期修改npm默认镜像源为国内镜像,后续所有npm相关操作均默认走稳定的国内节点:
    npm config set registry https://registry.npmmirror.com
    
    配置完成后直接正常执行初始化命令即可:
    npx create-react-app 你的项目名
    
  • 如果修改源后仍有报错,先清除本地npm缓存后重试:
    npm cache clean --force
    
  • 备用方案:使用yarn完成项目初始化,先全局安装yarn后执行:
    yarn create react-app 你的项目名
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.03 02:09:02