第一个Heroku部署失败`错误代码= H10` [英] First Heroku deploy failed `error code=H10`

查看:546
本文介绍了第一个Heroku部署失败`错误代码= H10`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的应用程序部署到Heroku。这是一个node.js + express + socket.io应用程序,这是 package.json 文件

  {
name:game_test,
author:Ilya,
description:我们的棋盘游戏的测试应用程序
version:0.0.1,
private:true,
scripts:{
start:node app
} ,
dependencies:{
express:3.0.6,
jade:*,
socket.io:*
},
engines:{
node:0.8.14
}
}
pre>

这是我得到的日志:

  heroku [router ]:at = error code = H10 desc =App crashedmethod = GET path = / host = game-test-1.herokuapp.com fwd = 37.26.146.185 dyno = queue = wait = connect = service = status = 503 bytes = 
heroku [router]:at = error code = H10 desc =App crashedmethod = GET path = / favicon.ico host = game-test-1.herokuapp.com fwd = 37.26.146.185 dyno = queue = wait = connect = service = status = 503 bytes =

这是否意味着?

解决方案

在此找到解决方案: Heroku + node.js错误(Web进程无法绑定到$ PORT内60秒的发布)



在我的情况下,我的应用程序崩溃,因为我很难设置端口,而不是使用heroku dinamicaly设置的端口,这可以可以使用 process.env.PORT

  app.listen(process .env.PORT || 3000,function(){
console.log(Express server listen in port%d in%s mode,this.address()。port,app.settings.env);
});


I deployed my app to Heroku. It's a node.js + express + socket.io app and this is the package.json file

{
  "name": "game_test",
  "author": "Ilya",
  "description": "A test app for our board game",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app"
  },
  "dependencies": {
    "express": "3.0.6",
    "jade": "*",
    "socket.io" : "*"
  },
 "engines": {
      "node": "0.8.14"
  }
}

This is the log I get:

heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=game-test-1.herokuapp.com fwd=37.26.146.185 dyno= queue= wait= connect= service= status=503 bytes=
heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=game-test-1.herokuapp.com fwd=37.26.146.185 dyno= queue= wait= connect= service= status=503 bytes=

What does it mean?

解决方案

Found solution for me here: Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)

In my case my app crashed because I was hard setting the PORT, instead of using the port that heroku dinamicaly sets, which can be accessed with process.env.PORT

app.listen(process.env.PORT || 3000, function(){
  console.log("Express server listening on port %d in %s mode", this.address().port, app.settings.env);
});

这篇关于第一个Heroku部署失败`错误代码= H10`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆