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

npm start启动React应用失败,遇'react-scripts'未识别等报错求排查

问题解答

你的package.json中的scripts配置完全没问题,是create-react-app项目的标准配置写法。报错的根源不在scripts配置,而是以下两个问题:

1. UNC路径不支持导致目录切换

CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.

Windows的CMD无法在UNC网络共享路径(比如\\服务器地址\共享文件夹这类路径)下正常运行npm命令,会自动切换到系统Windows目录,导致找不到项目内的依赖文件。

  • 解决方法:把项目克隆到本地磁盘的普通路径下(例如C:\dev\react-website),再进行后续操作。

2. 依赖未安装导致react-scripts无法识别

'react-scripts' is not recognized as an internal or external command, operable program or batch file.

即使路径正确,如果没有安装项目依赖,npm找不到node_modules里的react-scripts脚本,就会报这个错。

  • 解决步骤:
    • 切换到项目本地目录后,执行命令:npm install
    • 等待依赖安装完成后,再执行npm start即可正常启动项目。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.13 13:41:40