运行 npm start 时启动脚本丢失错误

问题描述 投票:0回答:1

我在尝试使用 npm start 命令调试节点应用程序时收到此错误。

错误:

npm ERR! Missing script: "start"
npm ERR! 
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in: C:\Users\Ezioria\AppData\Local\npm-cache\_logs\2023-12-26T12_43_00_567Z-debug-0.log

我真的被困在这里了,帮帮我吧。我也安装了package.json

javascript node.js package.json npm-scripts
1个回答
0
投票

您的 package.json 缺少您尝试运行的启动脚本。 假设您的 Node 应用程序的入口文件是 index.js,package.json 中的脚本部分应如下所示:

{
  "name": "app-name",
  "version": "2.0",
  "description": "application description",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.