简体   繁体   English

npm 启动命令:缺少脚本:启动

[英]npm start command: missing script: start

I'm receiving this error when trying to run my node application using the npm start command on Visual Studio Code.我在尝试使用 Visual Studio Code 上的 npm 启动命令运行我的节点应用程序时收到此错误。 Any help is greatly appreciate!非常感谢任何帮助!

This is what is inside my package.json file:这是我的 package.json 文件中的内容:

{
  "name": "bloggin-site",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "nodemon server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express-fileupload": "^1.2.1",
    "express.js": "^1.0.0",
    "nodemon": "^2.0.15"
  }
}

This is the message on terminal when I run the code:这是我运行代码时终端上的消息:

npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/wendyb/.npm/_logs/2021-12-06T06_01_12_013Z-debug.log```

This is what the debug log says:
```0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@6.14.15
3 info using node@v14.18.1
4 verbose stack Error: missing script: start
4 verbose stack     at run (/usr/local/lib/node_modules/npm/lib/run-script.js:155:19)
4 verbose stack     at /usr/local/lib/node_modules/npm/lib/run-script.js:63:5
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:116:5
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:436:5
4 verbose stack     at checkBinReferences_ (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:391:45)
4 verbose stack     at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:434:3)
4 verbose stack     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:161:5)
4 verbose stack     at ReadFileContext.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:350:20)
4 verbose stack     at ReadFileContext.callback (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:123:16)
4 verbose stack     at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:281:13)
5 verbose cwd /Users/wendyb/Desktop/Final
6 verbose Darwin 19.6.0
7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
8 verbose node v14.18.1
9 verbose npm  v6.14.15
10 error missing script: start
11 verbose exit [ 1, true ] ```


Maybe just check if you have defined correct path for your server.js file if not correct it and try or maybe just in case the changes you made in package.json file and haven't saved it just save it and try again也许只是检查你是否为你的 server.js 文件定义了正确的路径,如果没有更正它并尝试或者可能只是为了以防你在 package.json 文件中所做的更改并且没有保存它只是保存它并重试

for more help you can refer this link如需更多帮助,您可以参考此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM