Heroku Node.js-错误R10(引导超时)-> Web进程无法绑定到$ PORT

NIS_COLLECT

当我在Heroku上部署我的网站时,它说:

应用程序错误

应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查日志以获取详细信息。您可以使用Heroku logs --tail命令从Heroku CLI执行此操作

在日志中,当我检查时,似乎没有什么大不了的。它给出:-

2020-09-20T23:56:47.790226+00:00 app[web.1]: 

2020-09-20T23:56:48.040459+00:00 app[web.1]: SERVER IS RUNNIG AT PORT 8000

2020-09-20T23:56:48.040768+00:00 app[web.1]: Server runnung at http://127.0.0.1:5500

2020-09-20T23:57:44.991177+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

2020-09-20T23:57:45.017244+00:00 heroku[web.1]: Stopping process with SIGKILL

2020-09-20T23:57:45.087257+00:00 heroku[web.1]: Process exited with status 137

2020-09-20T23:57:45.132990+00:00 heroku[web.1]: State changed from starting to crashed

2020-09-21T02:05:44.125661+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sheetsw.herokuapp.com request_id=b87a2aae-a1d1-44d4-9f4e-2d10421edec6 fwd="27.60.151.127" dyno= connect= service= status=503 bytes= protocol=https

2020-09-21T02:05:46.906817+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sheetsw.herokuapp.com request_id=a46e447c-e111-4954-a6c6-a1e928013a82 fwd="27.60.151.127" dyno= connect= service= status=503 bytes= protocol=https

2020-09-21T02:06:05.637299+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sheetsw.herokuapp.com request_id=d6aa7d9b-60eb-450c-8ceb-c063faad3917 fwd="27.60.151.127" dyno= connect= service= status=503 bytes= protocol=https

您能告诉我哪里错了,为什么吗,也请我怎样克服这个问题?

我的server.js文件:-

    const express = require("express");

const fs = require('fs');

const nodemailer = require('nodemailer');
const  bodyParser = require('body-parser');
/** 
const port= 80; 
**/

const hostname= '127.0.0.1';
const port= 5500;

const path = require('path');


const app = express();

app.get('/register.html',(req,res) => {

 res.sendFile(__dirname + '/register.html')
})

/**app.use(express.static('./')); 
**/
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
sending();


function sending(){

   

const transporter = nodemailer.createTransport({
    service:'gmail',
    auth:{
        user:'[email protected]',
        pass:'free_fire123'        
    }
});

function sendEmail(mail)
{
 var mailOptions= {
     from: '[email protected]',
     to:mail.to,
     subject: mail.subject,
     html: mail.body
 }

transporter.sendMail(mailOptions, function(err, info) {
    if(err){
        console.log(err+"                    "+mail.to)
    }
    else {
        console.log("Email sent: "+info.response)
    }
})
}

app.post('/register.html', (req,res)=> {
    mail= {
        to:req.body.to_address,
        subject:"Sheets_Wrap - project details",
        body:req.body.NAME + "    ------------/////////////------------     "+ req.body.phone + "    ------------/////////////------------     " + req.body.email_body + "    ------------/////////////------------     " + req.body.code
    }
    sendEmail(mail)
    res.redirect('/register.html')
})


app.listen(port, ()=> {
    console.log('SERVER IS RUNNIG AT PORT 8000')
    console.log(`Server runnung at http://localhost:${port}/register.html`);
})
}
Prathamesh更多

问题:您的Node.js应用程序配置不正确,无法通过$ PORT环境变量绑定到Heroku提供的端口。

Heroku dynos公开了一个动态端口供您的应用绑定。此值在$ PORT env var中公开。您必须更改代码以绑定到该端口。例如:

//Replace your hardcoded port to process.env.PORT
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
    console.log(`Our app is running on port ${ PORT }`);
});

这将使用$ PORT env var(如果可用),或使用默认端口(适用于本地开发)。请注意,在Heroku上浏览到应用程序时,您仍然使用端口80([your-application] .herokuapp.com),而不是进程绑定到的端口。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

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

来自分类Dev

Heroku - 错误 R10(启动超时)-> Web 进程无法在使用 Webpack 启动后 60 秒内绑定到 $PORT

来自分类Dev

为什么Heroku上的Spray应用程序失败并显示“错误R10(引导超时)-> Web进程在启动后60秒内未能绑定到$ PORT”

来自分类Dev

错误R10(引导超时)->在使用React在HEROKU上启动后的60秒内,Web进程未能绑定到$ PORT

来自分类Dev

Akka 应用程序到 Heroku 出现错误:Web 进程无法绑定到 $PORT

来自分类Dev

在 Nodejs 上出现“错误 R10(启动超时)-> Web 进程无法在启动后 60 秒内绑定到 $PORT”

来自分类Dev

Heroku R10引导超时错误

来自分类Dev

Heroku R10引导超时错误

来自分类Dev

Web进程在启动node.js的60秒内未能绑定到$ PORT

来自分类Dev

Web进程在启动node.js的60秒内未能绑定到$ PORT

来自分类Dev

在Heroku上运行Dropwizard应用程序:R10未能绑定到$ PORT

来自分类Dev

带有Heroku错误的Python Twitter Bot:R10引导超时

来自分类Dev

在启动后的90秒内,Heroku- Web进程未能绑定到$ PORT。TooTallNate Websockets

来自分类Dev

在 Heroku 上运行我的应用程序时,为什么会出现引导超时错误(错误 R10)?

来自分类Dev

使用Heroku无法在Node js中获取/错误

来自分类Dev

Dockerized React App无法在Heroku上绑定到$ PORT

来自分类Dev

Heroku Python Web进程在60秒内未能绑定到$ PORT-并不明显

来自分类Dev

在Heroku上的Phoenix部署无法绑定$ PORT

来自分类Dev

Phoenix在Heroku上:错误R10

来自分类Dev

将Node.js应用程序部署到Heroku的应用程序错误

来自分类Dev

尝试将node.js部署到Heroku:发生编译错误?

来自分类Dev

node.js heroku-app / web.1:错误:未指定模板

来自分类Dev

无法在heroku上托管node.js应用程序。正在显示应用程序错误

来自分类Dev

如何使用Node.js绑定Heroku中的端口

来自分类Dev

将Node js应用程序部署到Heroku

来自分类Dev

如何从node.js@heroku上传图像到cloudinary?

来自分类Dev

Node.js环境检测无法运行Heroku

来自分类Dev

为什么Heroku无法检测到Node.js buildpack?

来自分类Dev

在Heroku上部署Node.js无法提供静态文件

Related 相关文章

  1. 1

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

  2. 2

    Heroku - 错误 R10(启动超时)-> Web 进程无法在使用 Webpack 启动后 60 秒内绑定到 $PORT

  3. 3

    为什么Heroku上的Spray应用程序失败并显示“错误R10(引导超时)-> Web进程在启动后60秒内未能绑定到$ PORT”

  4. 4

    错误R10(引导超时)->在使用React在HEROKU上启动后的60秒内,Web进程未能绑定到$ PORT

  5. 5

    Akka 应用程序到 Heroku 出现错误:Web 进程无法绑定到 $PORT

  6. 6

    在 Nodejs 上出现“错误 R10(启动超时)-> Web 进程无法在启动后 60 秒内绑定到 $PORT”

  7. 7

    Heroku R10引导超时错误

  8. 8

    Heroku R10引导超时错误

  9. 9

    Web进程在启动node.js的60秒内未能绑定到$ PORT

  10. 10

    Web进程在启动node.js的60秒内未能绑定到$ PORT

  11. 11

    在Heroku上运行Dropwizard应用程序:R10未能绑定到$ PORT

  12. 12

    带有Heroku错误的Python Twitter Bot:R10引导超时

  13. 13

    在启动后的90秒内,Heroku- Web进程未能绑定到$ PORT。TooTallNate Websockets

  14. 14

    在 Heroku 上运行我的应用程序时,为什么会出现引导超时错误(错误 R10)?

  15. 15

    使用Heroku无法在Node js中获取/错误

  16. 16

    Dockerized React App无法在Heroku上绑定到$ PORT

  17. 17

    Heroku Python Web进程在60秒内未能绑定到$ PORT-并不明显

  18. 18

    在Heroku上的Phoenix部署无法绑定$ PORT

  19. 19

    Phoenix在Heroku上:错误R10

  20. 20

    将Node.js应用程序部署到Heroku的应用程序错误

  21. 21

    尝试将node.js部署到Heroku:发生编译错误?

  22. 22

    node.js heroku-app / web.1:错误:未指定模板

  23. 23

    无法在heroku上托管node.js应用程序。正在显示应用程序错误

  24. 24

    如何使用Node.js绑定Heroku中的端口

  25. 25

    将Node js应用程序部署到Heroku

  26. 26

    如何从node.js@heroku上传图像到cloudinary?

  27. 27

    Node.js环境检测无法运行Heroku

  28. 28

    为什么Heroku无法检测到Node.js buildpack?

  29. 29

    在Heroku上部署Node.js无法提供静态文件

热门标签

归档