【问题标题】:HEROKU and HAPIJS Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launchHEROKU 和 HAPIJS 错误 R10(启动超时)-> Web 进程未能在启动后 60 秒内绑定到 $PORT
【发布时间】:2019-07-04 10:43:15
【问题描述】:

**HEROKU 日志 --tail***dasdasdsdsa HEROKU 和 HAPIJS 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定到 $PORTHEROKU 和 HAPIJS 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定到 $PORT HEROKU 和 HAPIJS 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定到 $PORTHEROKU 和 HAPIJS 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定到 $PORTHEROKU 和 HAPIJS 错误R10(启动超时)-> Web 进程在启动后 60 秒内未能绑定到 $PORT HEROKU 和 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"
  }
}

【问题讨论】:

  • 你能解决这个错误吗,我目前面临着类似的问题。

标签: node.js mongodb heroku hapijs hapi


【解决方案1】:

创建一个 Procfile(无扩展名)并在其中写入 app: node "your js for start".js 不带引号 然后使用 localhost 而不是 0.0.0.0 并在设置中https://dashboard.heroku.com/apps/"your app"/resources
有滑块 enter image description here

enter image description here

它对我有用,希望对你也有用。祝你好运)

【讨论】:

    猜你喜欢
    • 2021-04-05
    • 2021-08-19
    • 1970-01-01
    • 2016-03-08
    • 1970-01-01
    • 2020-12-09
    • 2019-04-20
    • 2015-09-14
    • 2021-07-26
    相关资源
    最近更新 更多