运行npm start时启动脚本缺少错误 [英] Start script missing error when running npm start

查看:771
本文介绍了运行npm start时启动脚本缺少错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm receiving this error when trying to debug my node application using the npm start command.

错误:


npm ERR! Windows_NT 6.3.9600
npm ERR! argvC:\Program Files \\\
odejs \\\\
ode.exeC:\Program Files\\\
odejs\\\
ode_modules\\\
pm\bin\\\
pm-cli.jsstart
npm ERR!节点v0.12.7
npm ERR! npm v2.11.3

npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" npm ERR! node v0.12.7 npm ERR! npm v2.11.3

npm ERR!缺少脚本:启动
npm ERR!
npm ERR!如果您需要帮助,可以在以下位置报告此错误:
npm ERR! ERR, https://github.com/npm/npm/issues npm!请在任何支持请求中包含以下文件:
npm ERR! C:\ Users \ andrmoll.NORTHAMERICA \Documents\GitHub\SVIChallenge\\\
pm-debug.log

npm ERR! missing script: start npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issuesnpm ERR! Please include the following file with any support request: npm ERR! C:\Users\andrmoll.NORTHAMERICA\Documents\GitHub\SVIChallenge\npm-debug.log

来自调试文件:


详细堆栈错误:缺少脚本:开始

verbose stack Error: missing script: start

运行时4个详细堆栈(C:\Program Files \\\
odejs \\\
ode_modules \\\
pm \lib \ run-script.js:142:19)

4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:142:19)

C处的4个详细堆栈:\Program Files \ nodejs \\\
ode_modules \ npm \ lib \ run-script.js:58:5

4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:58:5

C处的4个详细堆栈:\Program Files \\\
odejs \\\
ode_modules \ npm \ node_modules \read-package-json \read-json.js:345:5

4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:345:5

checkBinReferences_上的4个详细堆栈(C:\Program Files \\\
odejs\\\
ode_modules\\\
pm\\\
ode_modules \read-package-json \read-json.js:309 :45)

4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)

最后4个详细堆栈(C:\Program Files \ nodejs \\ \\ nnode_modules \ nnpm \\\
ode_modules \read-package-json \read-json.js:343:3)

4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)

4当时的详细堆栈(C: \Program Files\\\
odejs\\\
ode_modules\\\
pm\\\
ode_modules\read-package-json \read-json.js:113:5)

4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:113:5)

C处的4个详细堆栈:\ Program Files \\\
odejs \\\
ode_modules \ npm \ node_modules \read-package-json \read-json.js:300:12

4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:300:12

evalmachine上的4个详细堆栈。:334:14

4 verbose stack at evalmachine.:334:14

4个详细堆栈位于C:\Program Files \ nodejs \\\
ode_modules \ nnpm \\ \\ _node_modules\graceful-fs\graceful-fs.js:102:5

4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:102:5

4 FSReqWrap.oncomplete(evalmachine。:95:15)的详细堆栈p>

4 verbose stack at FSReqWrap.oncomplete (evalmachine.:95:15)


推荐答案

看起来你可能没有定义 start package.json 文件中的c $ c>脚本或您的项目不包含 server.js fil e。

It looks like you might not have defined a start script in your package.json file or your project does not contain a server.js file.


如果包的根目录中有server.js文件,则npm会将start命令默认为节点服务器。 js。

If there is a server.js file in the root of your package, then npm will default the start command to node server.js.

https ://docs.npmjs.com/misc/scripts#default-values

您可以将应用程序脚本的名称更改为 server.js 或将以下内容添加到 package.json

You could either change the name of your application script to server.js or add the following to your package.json

"scripts": {
    "start": "node your-script.js"
}

或者......你可以直接运行节点你的-script.js

Or ... you could just run node your-script.js directly

这篇关于运行npm start时启动脚本缺少错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆