React 应用程序初始化期间缺少脚本错误

时间:2021-04-05 21:27:14

标签: node.js reactjs react-native npm

<块引用>

节点 ./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 应用程序时遇到上述错误

1 个答案:

答案 0 :(得分:0)

我的 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"
  }
}