REACT npm 启动命令

我刚刚使用 create-react-app 命令创建了一个 React 应用程序,并将该应用程序命名为react-app。我按照以下步骤操作

  • cd使用进入该目录cd react-app/

  • 运行npm start命令

我遇到了一个错误:

npm ERR! Missing scripts: start

npm ERR! A complete log of this run can be found in:

C:\Users\user\Appdata\Roaming\npm-cache\_logs\2020-11-09T07_00_18_996z-debug.log

编辑:这是我的package.json的内容:


{

  "name": "react-app",

  "version": "0.1.0",

  "private": true,

  "dependencies": {

    "react": "^17.0.1",

    "react-dom": "^17.0.1",

    "react-scripts": "4.0.0"

  }

}

将这些脚本添加到我的 package.js 中是有效的,但引发了另一个问题。这是片段。

狐的传说
浏览 125回答 1
1回答

红颜莎娜

您必须在 package.json 中包含这些脚本。我的package.json"scripts": {    "start": "react-scripts start",    "build": "react-scripts build",    "test": "react-scripts test",    "eject": "react-scripts eject"  }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript