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

新建React项目执行npm start报错找不到react-scripts模块怎么办

React项目npm start启动MODULE_NOT_FOUND报错解决方案

报错原文:

rnal command, operable program or batch file.
node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'G:\Web-Development\Jumping into React\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

可按以下优先级依次尝试解决:

  • 修复项目路径问题:你当前的项目父级目录名Jumping into React带有空格,Windows系统下Node.js解析依赖路径时容易因空格出现识别错误。将该文件夹重命名为无空格、无特殊字符的格式,例如jumping-into-react,修改后进入项目目录重新执行npm start测试。
  • 检查本地react-scripts依赖:进入项目根目录执行npm list react-scripts,如果返回空或者报错,说明本地未正确安装该依赖,执行npm install react-scripts --save完成安装后再次尝试启动。
  • 全量重装依赖:如果上述操作无效,按顺序执行以下操作:
    1. 删除项目根目录下的node_modules文件夹和package-lock.json文件
    2. 执行npm cache clean --force清除npm全局缓存
    3. 执行npm install重新安装所有项目依赖
    4. 执行npm start启动开发服务
  • 校验启动脚本配置:打开项目根目录下的package.json文件,确认scripts字段配置符合以下规范:
    "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      "test": "react-scripts test",
      "eject": "react-scripts eject"
    }
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.29 15:36:03