【问题标题】:How to fix the error "react-scripts' is not recognized as an internal or external command, operable program or batch file." in React projects如何修复 React 项目中的错误“react-scripts”未被识别为内部或外部命令、可运行程序或批处理文件。
【发布时间】:2022-12-28 11:06:18
【问题描述】:

我创建了一个 React 项目,但是当我尝试使用 npm start 运行 React 应用程序时遇到问题。我尝试运行npm install来创建node_modules目录,但在运行过程中,该目录是临时创建的,然后在构建过程完成之前自动删除。我尝试了一些技巧来解决这个问题,例如npm install react-scriptsnpmcache clean --forcenpm cache clean --force,然后是npm updatenpm audit fix。但是,我仍然面临这个问题。

我检查了 package.json 文件中可用的反应脚本依赖项 "react-scripts": "4.0.3",

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

【问题讨论】:

  • 如果您的 node_modules/ 目录已经消失,那么 NPM 尝试运行的 node_modules/.bin/react-scripts 也会消失。

标签: reactjs


【解决方案1】:

试试这个,它对我有用

npm rebuild
npm install
npm install react-scripts --save
npm start

按照这里的答案 https://stackoverflow.com/a/65026207/20849940

【讨论】:

    猜你喜欢
    • 2020-02-02
    • 1970-01-01
    • 1970-01-01
    • 2019-09-16
    • 2021-11-07
    • 2018-06-04
    • 2018-03-20
    • 2018-08-03
    • 2015-12-30
    相关资源
    最近更新 更多