将 meanstack 应用程序部署到 heroku.. 错误代码:h10
deploying meanstack app to heroku.. error code: h10
我不断收到此错误:
我在 heroku 中查找了它,然后...它表明我的应用程序崩溃了...(感谢 heroku...)。
这是我的 package.json:
{
"name": "angular-express-part1",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "NODE_ENV=production nodemon ./bin/www",
"test": "NODE_ENV=development nodemon ./bin/www"
},
"dependencies": {
"async": "^2.0.0-rc.3",
"aws-sdk": "^2.3.11",
"bcryptjs": "^2.3.0",
"body-parser": "~1.0.0",
"cli-color": "^0.3.2",
"cookie-parser": "~1.0.1",
"crypto": "0.0.3",
"debug": "~0.7.4",
"express": "~4.0.0",
"express-method-override": "0.0.3",
"jwt-simple": "^0.5.0",
"moment": "^2.13.0",
"mongoose": "^4.4.14",
"morgan": "~1.0.0",
"request": "^2.72.0",
"static-favicon": "~1.0.0",
"underscore": "^1.6.0"
},
"engines": {
"node": "~5.10.0",
"npm" : "~3.8.0"
}
}
我的数据库配置:
var mongoose = require('mongoose');
// Connections
var developmentDb = process.env.MONGODB_URI;
var productionDb = process.env.MONGODB_URI;
var usedDb;
// If we're in develoment...
if (process.env.NODE_ENV === 'development') {
// set our database to the development one
usedDb = developmentDb;
// connect to it via mongoose
mongoose.connect(usedDb);
}
// If we're in production...
if (process.env.NODE_ENV === 'production') {
// set our database to the development one
usedDb = productionDb;
// connect to it via mongoose
mongoose.connect(usedDb);
}
// get an instance of our connection to our database
var db = mongoose.connection;
// Logs that the connection has successfully been opened
db.on('error', console.error.bind(console, 'connection error:'));
// Open the connection
db.once('open', function callback () {
console.log('Databsae Connection Successfully Opened at ' + usedDb);
});
不确定发生了什么。它正在生产中...
任何清晰度将不胜感激。
正在回答,因为我还不能发表评论。
如错误所示,路由器在尝试向您的应用程序发送请求时遇到崩溃进程。在这种情况下,最好 运行 您的日志尾部(例如 heroku logs --tail
),然后重新启动您的应用程序并观察堆栈跟踪。在那里您可以找到有关导致应用程序崩溃的原因的更多信息。
如果它通过启动成功,您可能需要进行一些验收测试,看看您可以遇到哪些问题导致应用程序崩溃,进而在日志中抛出异常。
我不断收到此错误:
我在 heroku 中查找了它,然后...它表明我的应用程序崩溃了...(感谢 heroku...)。
这是我的 package.json:
{
"name": "angular-express-part1",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "NODE_ENV=production nodemon ./bin/www",
"test": "NODE_ENV=development nodemon ./bin/www"
},
"dependencies": {
"async": "^2.0.0-rc.3",
"aws-sdk": "^2.3.11",
"bcryptjs": "^2.3.0",
"body-parser": "~1.0.0",
"cli-color": "^0.3.2",
"cookie-parser": "~1.0.1",
"crypto": "0.0.3",
"debug": "~0.7.4",
"express": "~4.0.0",
"express-method-override": "0.0.3",
"jwt-simple": "^0.5.0",
"moment": "^2.13.0",
"mongoose": "^4.4.14",
"morgan": "~1.0.0",
"request": "^2.72.0",
"static-favicon": "~1.0.0",
"underscore": "^1.6.0"
},
"engines": {
"node": "~5.10.0",
"npm" : "~3.8.0"
}
}
我的数据库配置:
var mongoose = require('mongoose');
// Connections
var developmentDb = process.env.MONGODB_URI;
var productionDb = process.env.MONGODB_URI;
var usedDb;
// If we're in develoment...
if (process.env.NODE_ENV === 'development') {
// set our database to the development one
usedDb = developmentDb;
// connect to it via mongoose
mongoose.connect(usedDb);
}
// If we're in production...
if (process.env.NODE_ENV === 'production') {
// set our database to the development one
usedDb = productionDb;
// connect to it via mongoose
mongoose.connect(usedDb);
}
// get an instance of our connection to our database
var db = mongoose.connection;
// Logs that the connection has successfully been opened
db.on('error', console.error.bind(console, 'connection error:'));
// Open the connection
db.once('open', function callback () {
console.log('Databsae Connection Successfully Opened at ' + usedDb);
});
不确定发生了什么。它正在生产中...
任何清晰度将不胜感激。
正在回答,因为我还不能发表评论。
如错误所示,路由器在尝试向您的应用程序发送请求时遇到崩溃进程。在这种情况下,最好 运行 您的日志尾部(例如 heroku logs --tail
),然后重新启动您的应用程序并观察堆栈跟踪。在那里您可以找到有关导致应用程序崩溃的原因的更多信息。
如果它通过启动成功,您可能需要进行一些验收测试,看看您可以遇到哪些问题导致应用程序崩溃,进而在日志中抛出异常。