将Node.js应用程序部署到Heroku时出错 [英] Error while deploying Node.js App to Heroku
问题描述
2017-04-18T18:40:10.158442 +00:00应用[web.1]:npm ERR!请在任何支持请求中包含以下文件:
2017-04-18T18:40:10.158544 + 00:00 app [web.1]:npm ERR! /app/npm-debug.log
2017-04-18T18:40:10.237236 + 00:00 heroku [web.1]:状态从开始更改为崩溃
2017-04-18T18:40:10.230110 + 00:00 heroku [web.1]:进程退出状态1
2017-04-18T18:40:29.015395 + 00:00 heroku [router]:at = error code = H10 desc =App crashedmethod = GET path =/host = nandu-varun-webdev。 herokuapp.com request_id = 11f3e405-089e-4bef-a83c-f190b042fbb7 fwd =216.15.126.238dyno = connect = service = status = 503 bytes = protocol = https
2017-04-18T18:40:29.282812 + 00:00 heroku [router]:at = error code = H10 desc =App crashedmethod = GET path =/ favicon.icohost = nandu-varun-webdev.herokuapp .com request_id = 904f2f85-9c15-4601-bb9a-51a58c7544e1 fwd =216.15.126.238dyno = connect = service = status = 503 bytes = protocol = https
我的package.json文件如下:
{
name:web -dev,
version:1.0.0,
description: Web Dev,
main:server.js,
dependencies:{
body-parser:^ 1.15.1,
表示:^ 4.13.4,
mongoose:^ 4.4.15,
multer:^ 1.3.0,
q:^ 1.4.1,
passport:^ 0.3.2,
passport-local:^ 1.0.0,
cookie-parser:^ 1.4 .1,
bcrypt-nodejs:0.0.3,
node-uuid:^ 1.4.7,
express-session:^ 1.13 .0
,
devDependencies:{},
scripts:{
test:echo \错误:指定&&退出1,
start:node server.js
},
author:VN,
license:ISC
}
我的Server.js文件如下所示:
var express = require('express');
var app = express();
var bodyParser = require(' );
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
/ /配置一个公共目录来存放静态内容
app.use(express.static(__ dirname +'/ public'));
require(./test/app.js) (app);
require(./assignment/app.js\")(app);
require(./project/app\")(app);
var port = process.env.PORT || 3000;
app.listen(port);
编辑:这些是我收到的完整日志
2017-04-19T11:38:05.924799 + 00: 00 app [web.1]:npm ERR!如果这样做,这很可能是web-dev软件包的问题,
2017-04-19T11:38:05.925332 + 00:00 app [web.1]:npm ERR!您可以通过以下方式获得有关如何为此项目打开问题的信息: 2017-04-19T11:38:05.925449 + 00:00 app [web.1]: npm ERR! npm错误web-dev
2017-04-19T11:38:05.925583 + 00:00 app [web.1]:npm ERR!或者,如果没有,您可以通过以下方式获取他们的信息:
2017-04-19T11:38:05.925712 + 00:00 app [web.1]: npm ERR! npm owner ls web-dev
2017-04-19T11:38:05.925846 + 00:00 app [web.1]:npm ERR!
2017-04-19T11:38:05.930287 + 00:00 app [web.1]:
2017-04-19T11:38:05.930497 + 00:00 app [web.1]:npm ERR!请在任何支持请求中包含以下文件:
2017-04-19T11:38:05.930608 + 00:00 app [web.1]:npm ERR! /app/npm-debug.log
2017-04-19T11:38:06.002754 + 00:00 heroku [web.1]:状态从开始更改为崩溃
2017-04-19T11:38:05.995921 + 00:00 heroku [web.1]:进程退出状态1
2017-04-19T14:44:20.909797 + 00:00 heroku [router]:at = error code = H10 desc =App crashedmethod = GET path =/host = nandu-varun-webdev。 herokuapp.com request_id = ab500e0f-0137-4b2f-ae8d-fb99c0849597 fwd =216.15.126.238dyno = connect = service = status = 503 bytes = protocol = https
2017-04-19T14:44:21.392032 + 00:00 heroku [router]:at = error code = H10 desc =App crashedmethod = GET path =/ favicon.icohost = nandu-varun-webdev.herokuapp .com request_id = 6a277e5f-2329-45d1-82af-4a4cd170e028 fwd =216.15.126.238dyno = connect = service = status = 503 bytes = protocol = https
我无法弄清楚问题所在或为什么无法成功部署。
任何帮助都将非常感谢
提前致谢
您必须创建一个 Procfile
包含此: web:npm start
是否包含它?
While deploying my Node.js App on Heroku I am getting the following error.
2017-04-18T18:40:10.158442+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-04-18T18:40:10.158544+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-04-18T18:40:10.237236+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-18T18:40:10.230110+00:00 heroku[web.1]: Process exited with status 1
2017-04-18T18:40:29.015395+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nandu-varun-webdev.herokuapp.com request_id=11f3e405-089e-4bef-a83c-f190b042fbb7 fwd="216.15.126.238" dyno= connect= service= status=503 bytes= protocol=https
2017-04-18T18:40:29.282812+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nandu-varun-webdev.herokuapp.com request_id=904f2f85-9c15-4601-bb9a-51a58c7544e1 fwd="216.15.126.238" dyno= connect= service= status=503 bytes= protocol=https
My package.json file is the following
{
"name": "web-dev",
"version": "1.0.0",
"description": "Web Dev",
"main": "server.js",
"dependencies": {
"body-parser": "^1.15.1",
"express": "^4.13.4",
"mongoose": "^4.4.15",
"multer":"^1.3.0",
"q": "^1.4.1",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"cookie-parser": "^1.4.1",
"bcrypt-nodejs": "0.0.3",
"node-uuid": "^1.4.7",
"express-session": "^1.13.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "VN",
"license": "ISC"
}
And my Server.js file is as follows:
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
// configure a public directory to host static content
app.use(express.static(__dirname + '/public'));
require ("./test/app.js")(app);
require ("./assignment/app.js")(app);
require ("./project/app")(app);
var port = process.env.PORT || 3000;
app.listen(port);
Edit: These are the complete logs i am getting
2017-04-19T11:38:05.924799+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the web-dev package,
2017-04-19T11:38:05.925332+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-04-19T11:38:05.925449+00:00 app[web.1]: npm ERR! npm bugs web-dev
2017-04-19T11:38:05.925583+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-04-19T11:38:05.925712+00:00 app[web.1]: npm ERR! npm owner ls web-dev
2017-04-19T11:38:05.925846+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-04-19T11:38:05.930287+00:00 app[web.1]:
2017-04-19T11:38:05.930497+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-04-19T11:38:05.930608+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-04-19T11:38:06.002754+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-19T11:38:05.995921+00:00 heroku[web.1]: Process exited with status 1
2017-04-19T14:44:20.909797+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nandu-varun-webdev.herokuapp.com request_id=ab500e0f-0137-4b2f-ae8d-fb99c0849597 fwd="216.15.126.238" dyno= connect= service= status=503 bytes= protocol=https
2017-04-19T14:44:21.392032+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nandu-varun-webdev.herokuapp.com request_id=6a277e5f-2329-45d1-82af-4a4cd170e028 fwd="216.15.126.238" dyno= connect= service= status=503 bytes= protocol=https
I just cannot figure out what the problem is or why am I unable to deploy successfully.
Any Help would be much appreciated
Thanks In Advance
you must create a Procfile that contains this :
web: npm start
did you include it ?
这篇关于将Node.js应用程序部署到Heroku时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!