【问题标题】:missing script error during the initialization of a react app在 React 应用程序初始化期间缺少脚本错误
【发布时间】:2021-04-05 21:27:14
【问题描述】:

节点 ./postinstall.js

  • react-scripts@4.0.3
  • react@17.0.2
  • react-dom@17.0.2 添加了来自 732 个贡献者的 1922 个包,并在 1282.186 秒内审核了 1925 个包

135 个软件包正在寻找资金 运行npm fund了解详情

发现 0 个漏洞

未提供模板。这可能是因为您使用的是过时版本的 create-react-app。 请注意,不再支持 create-react-app 的全局安装。 您可以在再次使用 create-react-app 之前运行 npm uninstall -g create-react-app 或 yarn global remove create-react-app 来解决此问题。

C:\Windows\System32\react-app> npm start npm 错误!缺少脚本:开始

npm 错误!可以在以下位置找到此运行的完整日志: npm 错误! C:\Users\ObiTech ICT Solution\AppData\Roaming\npm-cache_logs\2021-04-05T21_07_44_609Z-debug.log

我在尝试启动新的 React 应用程序时遇到上述错误

【问题讨论】:

  • 你运行什么命令来创建 react 应用程序?
  • create-react-app react-app(创建)npm start(初始化)
  • 创建应用程序后,您需要通过运行cd react-app 进入应用程序文件夹,然后运行npm run start
  • 我现在才这样做,但仍然得到相同的响应
  • 你能把你package.json的内容贴出来吗?

标签: node.js reactjs react-native npm


【解决方案1】:

我的 package.json 缺少启动脚本

package.json 文件的内容如下:

   {
  "name": "reactapp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "start": "react-scripts start", 
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
},
  "dependencies": {
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3"
  }
}

【讨论】:

    猜你喜欢
    • 2021-09-15
    • 2022-06-27
    • 2021-11-04
    • 1970-01-01
    • 2022-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-23
    相关资源
    最近更新 更多