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

执行npm start报错sh: react-scripts-start: command not found求助

解决react-scripts-start: command not found启动错误

嘿,这个问题我之前踩过一模一样的坑!看你报错里的关键提示:sh: react-scripts-start: command not found,核心问题其实很简单——启动脚本的命令写错了,正确的命令应该是react-scripts start(注意中间有空格),而不是把两个词连在一起写。

下面是具体的解决步骤:

  • 第一步:修正package.json里的启动脚本
    打开项目根目录下的package.json文件,找到scripts区块里的start字段,把react-scripts-start改成react-scripts start。正确的配置应该类似这样:

    "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      "test": "react-scripts test",
      "eject": "react-scripts eject"
    }
    
  • 第二步:重新安装依赖(可选但保险)
    如果你改完脚本还是报错,大概率是node_modules里的依赖出现了异常(比如添加git仓库后依赖没同步)。可以执行以下命令重置依赖:

    1. 删除旧的依赖文件夹和锁文件:
      rm -rf node_modules package-lock.json
      
    2. 重新安装所有依赖:
      npm install
      
  • 第三步:重新启动项目
    做完上面的操作后,再运行npm start,应该就能正常启动React项目了。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 06:45:48