错误消息
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.
我看过像我这样的几个问题,
Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)
Heroku code=H10 desc="App crashed" - Can't figure out why it's crashing
但我不认为我犯了同样的错误。
const express = require('express');
const app = express();
const wetalk = require('./app');
const passport = require('passport');
app.set('port', process.env.PORT || 3000);
app.use(express.static('public'));
app.set('view engine', 'ejs');
app.use(wetalk.session);
app.use(passport.initialize());
app.use(passport.session());
app.use(require('morgan')('combined', {
stream: {
write: message => {
//write to logs
wetalk.logger.log('info', message);
}
}
}));
//router
app.use('/', wetalk.router);
wetalk.ioServer(app).listen(app.get('port'), () => {
console.log('Wetalk running on the port', app.get('port'));
});
下面是我在git push heroku master上的控制台
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 309 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 4.2.2
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Downloading and installing node 4.2.2...
remote: Using default npm version: 2.14.7
remote:
remote: -----> Restoring cache
remote: Loading 2 from cacheDirectories (default):
remote: - node_modules
remote: - bower_components (not cached - skipping)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote:
remote: -----> Caching build
remote: Clearing previous node cache
remote: Saving 2 cacheDirectories (default):
remote: - node_modules
remote: - bower_components (nothing to cache)
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 15.5M
remote: -----> Launching...
remote: Released v14
remote: https://we-talk-cds.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/we-talk-cds.git
d9bfd0f..a10aa13 master -> master
这是在控制台上显示的内容,似乎是正确的 任何帮助表示赞赏
答案 0 :(得分:0)
检查您的日志。您正在使用Papertrail。