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

创建React App时遇异常:提示删应用而非创建,按文档操作仍报错

Fix: create-react-app Deleting Instead of Creating Your App

Hey there, sorry to hear you're stuck with this frustrating issue—following the official docs perfectly and still having create-react-app delete stuff instead of building your project? Let's work through the most likely fixes step by step.

Common Causes & Solutions

1. Global Version Conflict (Most Likely Culprit)

Older global installations of create-react-app can have bugs or clash with the latest npx-managed version. Here's how to fix it:

  • First, uninstall any global copy of the tool:
    npm uninstall -g create-react-app
    # If you use yarn:
    yarn global remove create-react-app
    
  • Now create your app using npx directly (this pulls the latest, official version every time):
    npx create-react-app your-app-name
    

This avoids any stale global packages messing up the process.

2. Corrupted npm/Yarn Cache

Sometimes cached package data gets corrupted, leading to unexpected behavior. Clear the cache and try again:

  • For npm:
    npm cache clean --force
    
  • For Yarn:
    yarn cache clean
    

After clearing, re-run the npx create-react-app command.

3. Accidental Delete Flag (Double-Check Your Command)

It sounds silly, but double-check you didn't accidentally add a delete-related typo or flag to your command. Ensure your command is exactly:

npx create-react-app your-app-name

No extra parameters that might trigger unintended deletion.

4. Node.js/NPM Version Compatibility

create-react-app requires specific minimum versions of Node.js and npm:

  • Node.js >= 14.0.0
  • npm >= 5.6
    Check your current versions with:
node -v
npm -v

If your versions are too low, upgrade Node.js (using a version manager like nvm is recommended to avoid system-level issues).

5. File System Permissions Issues

On Linux/macOS, permission errors can cause unexpected behavior. Try running the command with sudo (use cautiously):

sudo npx create-react-app your-app-name

On Windows, open your command prompt or PowerShell as an administrator before running the command.

Final Notes

If none of these work, try creating the app in a different directory (to rule out weird folder permissions or existing hidden files causing conflicts). Most of the time, the global uninstall + fresh npx run fixes this issue.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.09 12:07:51