Heroku返回退出状态为143的进程

时间:2016-10-31 17:11:40

标签: javascript node.js heroku socket.io

我即将完成使用 socket.io Ionic2 应用程序。 我用一个终端中的ionic serve(客户端)和另一个终端上的node index.js(服务器端)运行(本地)我的应用程序。 (index.js文件位于我的ionic2项目文件夹中)。 现在我想用Heroku试试这个。

这些是我的服务器端文件:

我的index.js文件如下所示:

var io = require('socket.io'),
    http = require('http'),
    server = http.createServer(),
    io = io.listen(server);
...
...
my real code here
...
...
server.listen(process.env.PORT || 3000, function(){
  console.log('Server started, listening on' + process.env.PORT);
});

与index.js一起创建(npm init)包json,如下所示:

{
  "name": "myApplication",
  "version": "0.2.5",
  "description": "just a server",
  "engines": {
    "node": "4.2.6"
  },
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "dependencies": {
    "ejs": "2.4.1",
    "express": "4.13.3",
    "socket.io": "^1.5.0"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/xxxxxxxxx"
  },
  "keywords": [
    "node",
    "heroku",
    "express"
  ],
  "license": "MIT"
}

Procfile内容是:web: node index.js

虽然app.json持有这个:

{
  "name": "MyAppServer",
  "description": "",
  "repository": "https://github.com/xxxxxxxx",
  "logo": "http://node-js-sample.herokuapp.com/node.svg",
  "keywords": ["node", "express", "static"],
  "image": "heroku/nodejs"
}

在将所有这些内容推送到github repo之前我已经完成了npm install所以我得到了node_modules个文件夹。 所以我把所有东西都推到了github仓库,然后是heroku loginheroku create。最后git push heroku master返回了我Build succeeded但现在,当我heroku open时,我看到一个页面显示应用程序错误

这些是我heroku logs时收到的警告:

    2016-10-31T14:00:05.707656+00:00 heroku[web.1]: Idling
    2016-10-31T14:00:05.708289+00:00 heroku[web.1]: State changed from up to down
    2016-10-31T14:00:08.267802+00:00 heroku[web.1]: Stopping all processes with SIGTERM
    2016-10-31T14:00:09.009402+00:00 heroku[web.1]: Process exited with status 143
    2016-10-31T16:34:38.691494+00:00 heroku[web.1]: State changed from down to starting
    2016-10-31T16:34:40.170397+00:00 heroku[web.1]: Starting process with command `node index.js`
    2016-10-31T16:34:42.503141+00:00 app[web.1]: Server started, listening on39519
    2016-10-31T16:34:43.875418+00:00 heroku[web.1]: State changed from starting to up

2016-10-31 heroku[router]: at=error code=H12
 desc="Request timeout" method=GET path="/" host=xxxx-xxxx-xxxx.herokuapp.com 
request_id=20f79d56-4e51-4ace-af50-9b332e9778a1 fwd="my IP address here" dyno=web.1 connect=0ms 
service=30000ms status=503 bytes=0

0 个答案:

没有答案