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

安装Redux后react-scripts丢失,Create React App项目运行异常求助

Fixing React-Scripts Failure After Installing Old react-redux Version

Hey there, let's figure out what went wrong and get your project back up and running quickly.

What Caused the Problem

The react-redux@5.0.7 version you installed is extremely outdated—this release dates back to 2018, and it’s incompatible with the modern React dependencies that come with a fresh Create React App project. When your package manager (npm/yarn) tried to satisfy this old version’s requirements, it had to remove over 1000 existing packages (including core dependencies for react-scripts) to resolve conflicts, which broke your project’s ability to run.

Step-by-Step Fix

  1. Clean up the broken dependency state

    • First, delete the node_modules folder (this holds all your installed packages) and the lock file (package-lock.json for npm, yarn.lock for yarn). You can do this manually, or run these commands:
      # For npm users
      rm -rf node_modules package-lock.json
      
      # For yarn users
      rm -rf node_modules yarn.lock
      
  2. Install compatible versions of react-redux and redux
    Skip specifying the old version number—install the latest stable versions that work with your Create React App setup:

    # npm
    npm install react-redux redux
    
    # yarn
    yarn add react-redux redux
    

    Your package manager will automatically pick versions that play nice with your existing project dependencies, no more mass package deletions.

  3. Restart your project
    Run the start command like you normally would:

    npm start
    # or
    yarn start
    

    Your project should boot up without issues now.

Quick Tip for the Future

Unless you have a specific reason to use an old package version, always install the latest stable release by default. If you do need a specific version, double-check that it’s compatible with your project’s current React version first—this avoids messy dependency conflicts like the one you ran into.

内容的提问来源于stack exchange,提问作者Marek Hubáček

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 08:57:57