【发布时间】:2017-11-06 20:49:58
【问题描述】:
我正在使用 NodeJS 创建一个聊天应用程序,并且我想部署到 Heroku。但是,我收到一个错误:An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. 使用 Github 部署。有谁知道发生了什么?
这里有一些代码来看看我做了什么。
{
"name": "chat",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./lib/index.js",
"test": "jasmine"
},
"dependencies": {
"express": "~4.13.1",
"firebase": "^3.9.0",
"request-promise": "^2.0.1",
"socket.io": "^1.4.5"
},
"devDependencies": {
"jasmine-sinon": "^0.4.0",
"jscs": "^2.11.0",
"proxyquire": "^1.7.4",
"rewire": "^2.5.1",
"sinon": "^1.17.3"
}
}
index.js(服务器)
var express = require('express');
var app = express();
var path = require('path');
var http = require('http').Server(app);
var io = require('socket.io')(http);
var routes = require('./routes');
var chats = require('./chat');
app.use(express.static(path.join(__dirname, '../public')));
routes.load(app);
chats.load(io);
var port = process.env.PORT || 3000;
app.listen(port);
console.log('Server is listening at port:' + port);
【问题讨论】:
-
检查
heroku logs -t它通常会显示更多信息,说明您的应用崩溃的原因。 -
我可以给你看看我的github项目,看看我做错了什么吗?我想做的是在heroku中使用Github部署
-
当然,您也可以阅读本指南,因为它将帮助您将 GH 部署集成到 Heroku devcenter.heroku.com/articles/github-integration
-
@LeoCorrea 我做了,但得到了同样的错误。
-
错误是什么?链接我到你的github项目,我去看看