HEROKU和HAPIJS错误R10(引导超时)-> Web进程在启动后60秒内未能绑定到$ PORT

时间:2019-02-10 23:11:01

标签: node.js mongodb heroku hapijs hapi

** HEROKU日志--tail *** dasdasdsdsa HEROKU和HAPIJS错误R10(引导超时)-> Web进程未能在启动后60秒内绑定到$ PORTHEROKU和HAPIJS错误R10(引导超时)-> Web进程未能在启动后60秒内绑定到$ PORT HEROKU和HAPIJS错误R10(引导超时)-> Web进程在启动后60秒内未能绑定到$ PORTHEROKU和HAPIJS错误R10(引导超时)-> Web进程在启动60秒内未能绑定到$ PORT R10(引导超时)-> Web进程在启动后60秒内未能绑定到$ PORTHEROKU和HAPIJS错误R10(引导超时)-> Web进程在启动后60秒内未能绑定到$ PORT     使用命令npm start

启动过程
    2019-02-10T22:55:41.713305+00:00 heroku[web.1]: State changed from starting to crashed
    2019-02-10T22:55:41.565831+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
    2019-02-10T22:55:41.565970+00:00 heroku[web.1]: Stopping process with SIGKILL
    2019-02-10T22:55:41.695141+00:00 heroku[web.1]: Process exited with status 137

我的服务器启动。

'use strict';

// Create a server with a host and port
const server=Hapi.server({
    host:'0.0.0.0',
    port: process.env.PORT | 8000
});

// Add the route
server.route({
  method:'GET',
  path:'/hello',
  handler:function(request,h) {

      return'hello world';
  }
});

// Start the server
const start =  async function() {

  try {
      await server.start();
  }
  catch (err) {
      console.log(err);
      process.exit(1);
  }

  console.log('Server running at:', server.info.uri);
};

start();

打包JSON

{
  "name": "Fish",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "yarn test",
    "dev": "NODE_ENV=development nodemon server.js",
    "start": "node server.js",
    "deploy": "git add . && git commit -m 'deploy automatitly' && git push heroku master"
  },

  "license": "ISC",
  "dependencies": {
    "boom": "^7.3.0",
    "hapi": "^17.8.4",
    "hapi-server-session": "^4.3.1",
    "hapi-swagger": "^9.3.1",
    "inert": "^5.1.2",
    "joi": "^14.3.1",
    "mongoose": "^5.4.11",
    "rest-hapi": "^1.3.3",
    "vision": "^5.4.4"
  },
  "devDependencies": {
    "nodemon": "^1.18.10"
  },
  "engines": {
    "node": "~8.11.4",
    "npm": "5.6.0"
  }
}

0 个答案:

没有答案