Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Heroku:部署时出现大量npm错误_Node.js_Heroku_Npm - Fatal编程技术网

Node.js Heroku:部署时出现大量npm错误

Node.js Heroku:部署时出现大量npm错误,node.js,heroku,npm,Node.js,Heroku,Npm,我的heroku日志中有很多npm错误。我如何开始调试这个?谢谢 package.json { "name": "server", "version": "1.0.0", "description": "", "main": "index.js", "engines": { "node": "8.1.1", "npm": "5.0.3" }, "scripts": { "start": "node index.js" }, "author": "", "license":

我的heroku日志中有很多npm错误。我如何开始调试这个?谢谢

package.json

{
 "name": "server",
 "version": "1.0.0",
 "description": "",
 "main": "index.js",
 "engines": {
 "node": "8.1.1",
 "npm": "5.0.3"
},
 "scripts": {
 "start": "node index.js"
},
 "author": "",
 "license": "ISC",
 "dependencies": {
    "express": "^4.16.0"
 }
}

NPM错误:缺少脚本:开始

您似乎缺少package.json文件中的“start”脚本。那就是我要开始寻找的地方。Heroku可能认为您已经事先设置好了此脚本。下面是一个示例package.json文件和启动脚本:

{
    "name": "your-app",
    "version": "1.0.0",
    "main": "index.js",
    "scripts": { // your npm scripts go here
        "start": "nodemon index.js", // or whatever server package you're using
        "lint:js": "node_modules/eslint/bin/eslint.js ./ ./**/*.js --fix; exit 0",
        "lint:css": "node_modules/csslint/cli.js public/css/; exit 0",
        "test": "NODE_ENV=test node_modules/mocha/bin/mocha"
    },
    "more": "settings below"
}
以下是Heroku网站上的一条宣传语:

指定开始脚本

为了确定如何启动你的应用程序,Heroku首先查找Procfile。如果Node.js应用程序不存在Procfile,我们将尝试通过package.json中的启动脚本启动默认web进程。 web进程类型中的命令必须绑定到端口环境变量中指定的端口号。如果没有,dyno将不会启动。 有关更多信息,请参阅Node.js开发和Heroku Node.js支持的最佳实践

请查看。您已经尝试过什么来发现问题?堆栈溢出不是调试服务的原因。问题应该显示研究的证据和自己解决问题的尝试,你的特定编码相关问题的清晰轮廓,以及a中的任何相关代码,因此我们有足够的信息能够提供帮助。