运行 npm start 时启动脚本丢失错误 [英] Start script missing error when running npm start
问题描述
我在尝试使用 npm start
命令调试我的节点应用程序时收到此错误.
npm ERR!Windows_NT 6.3.9600npm 错误!argv "C:\Program Files\nodejs\\node.exe";C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js"开始"npm 错误!节点 v0.12.7npm 错误!npm v2.11.3npm 错误!缺少脚本:开始npm 错误!npm 错误!如果您需要帮助,您可以在以下位置报告此错误:npm 错误!<https://github.com/npm/npm/issues>npm 错误!请在任何支持请求中包含以下文件:npm 错误!C:Usersandrmoll.NORTHAMERICADocumentsGitHubSVIChallenge
pm-debug.log
从调试文件:
错误:缺少脚本:开始运行时 (C:Program Files
odejs
ode_modules
pmlib
un-script.js:142:19)在 C:Program Files
odejs
ode_modules
pmlib
un-script.js:58:5在 C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:345:5在 checkBinReferences_ (C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:309:45)最后 (C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:343:3)然后 (C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:113:5)在 C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:300:12在 evalmachine.<匿名>:334:14在 C:Program Files
odejs
ode_modules
pm
ode_modulesgraceful-fsgraceful-fs.js:102:5在 FSReqWrap.oncomplete (evalmachine.:95:15)
看起来您可能没有在 package.json
文件或您的文件中定义 start
脚本项目不包含 server.js
文件.
如果你的包根目录中有 server.js 文件,那么 npm 会默认启动命令为 node server.js.
https://docs.npmjs.com/misc/scripts#default-values>
您可以将应用程序脚本的名称更改为 server.js
或将以下内容添加到您的 package.json
脚本":{"start": "node your-script.js"}
或者……你可以直接运行node your-script.js
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! 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! missing script: start
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>npm ERR! Please include the following file with any support request:
npm ERR! C:Usersandrmoll.NORTHAMERICADocumentsGitHubSVIChallenge
pm-debug.log
From the debug file:
Error: missing script: start
at run (C:Program Files
odejs
ode_modules
pmlib
un-script.js:142:19)
at C:Program Files
odejs
ode_modules
pmlib
un-script.js:58:5
at C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:345:5
at checkBinReferences_ (C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:309:45)
at final (C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:343:3)
at then (C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:113:5)
at C:Program Files
odejs
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:300:12
at evalmachine.<anonymous>:334:14
at C:Program Files
odejs
ode_modules
pm
ode_modulesgraceful-fsgraceful-fs.js:102:5
at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)
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.
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
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"
}
Or ... you could just run node your-script.js
directly
这篇关于运行 npm start 时启动脚本丢失错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!