gpt4 book ai didi

node.js - HEROKU 和 HAPIJS 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定(bind)到 $PORT

转载 作者:行者123 更新时间:2023-12-05 07:25:56 25 4
gpt4 key购买 nike

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

最佳答案

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

enter image description here

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

关于node.js - HEROKU 和 HAPIJS 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定(bind)到 $PORT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54622076/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com