【问题标题】:Why won't npm start execute?为什么 npm start 不执行?
【发布时间】:2019-07-22 18:51:49
【问题描述】:

我不断得到:

C:\AppData>npm start
npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\AppData\Roaming\npm-cache\_logs\2019-02-28T18_08_25_285Z- 

调试日志

我的包文件如下:

{
"name": "first",
 "version": "0.1.0",
"private": true,
 "dependencies": {
 "react": "^16.8.3",
"react-dom": "^16.8.3",
"react-scripts": "2.1.5"
   },
   "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
   "eject": "react-scripts eject"
 },
 "eslintConfig": {
   "extends": "react-app"
 },
 "browserslist": [
"cover 99.5%",
"not dead",
"not ie <= 11",
"not op_mini all"
   ]
 }

我是 npm 新手,当我第一次下载它时,我能够在本地服务器上启动它,没有问题。

我想打开我的浏览器,但在这样做的过程中,突然 npm start 出现了问题。

我知道还有其他类似的问题,但没有一个能缓解我的问题。

【问题讨论】:

标签: javascript reactjs npm


【解决方案1】:

正如@Arfeo 所说,只需致电npm run start。

【讨论】:

  • 致电npm install 然后npm run start。
  • @Ewubbs 如果您从您的package.json 所在的目录中运行npm run start,这是不可能的。如果仅此错误与react-scripts start 无关。哈哈。尝试执行react-scripts start?..
【解决方案2】:

您的package.json 在哪里?

例如,如果您的答案是c:\AppData\Eugene\react-app 您需要更改目录(仅一次),

cd c:\AppData\Eugene\react-app

然后运行你的 npm 命令

npm start
npm run build

等

【讨论】:

  • 它位于我为我制作的“第一个”npm 中,其中包括 package.json、src、node_modules 等
  • 在那个文件夹中打开一个终端并运行你的 npm 命令
猜你喜欢
  • 2021-10-03
  • 1970-01-01
  • 1970-01-01
  • 2014-11-17
  • 2020-02-24
  • 2023-04-04
  • 1970-01-01
  • 1970-01-01
  • 2019-07-03
相关资源
最近更新 更多