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

Create-react-app安装失败,提示“template not found”求解决方案

解决Create React App "template not found" 错误的可行方案
  • 直接用指定最新版本的npx命令创建项目,规避全局依赖残留问题:
    npx create-react-app@latest my-app
    # 需要TypeScript模板则用这条
    npx create-react-app@latest my-app --template typescript
    
  • 彻底清理npm缓存并重置源:
    1. 强制清理缓存:npm cache clean --force
    2. 切换到官方npm源(避免镜像源同步延迟导致模板拉取失败):npm config set registry https://registry.npmjs.org/
  • 显式指定官方基础模板:
    如果默认模板匹配失效,直接指定官方基础模板包:
    npx create-react-app my-app --template cra-template
    
  • 删除本地残留的配置文件:
    检查用户根目录下的.npmrc或.yarnrc文件,若有自定义镜像或特殊配置,暂时重命名或删除后重试。
  • 手动清除npm缓存目录:
    • Windows:删除%LOCALAPPDATA%\npm-cache文件夹
    • Mac/Linux:删除~/.npm文件夹
      完成后重新运行项目创建命令。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.28 01:27:03