【问题标题】:NodeJS app error during deploy to heroku app部署到 Heroku 应用程序期间的 NodeJS 应用程序错误
【发布时间】:2018-07-27 13:23:25
【问题描述】:

我正在尝试将我的项目部署到 herokuapp,但出现了一些错误:

2018-07-27T08:27:30.827410+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=ihealth99.herokuapp.com request_id=54687736-9467-4484-93d6-b2f016548ce2 fwd="140.213.36.56" dyno= connect= service= status=503 bytes= protocol=https
2018-07-27T08:27:30.828380+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ihealth99.herokuapp.com request_id=56351cf4-d736-4688-957b-8430d136a3b5 fwd="140.213.36.56" dyno= connect= service= status=503 bytes= protocol=https
2018-07-27T08:27:33.083646+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ihealth99.herokuapp.com request_id=0558bd4d-42aa-48c5-9c37-05dd43a9e1b9 fwd="140.213.36.56" dyno= connect= service= status=503 bytes= protocol=https

有人知道这是怎么回事吗?

【问题讨论】:

    标签: node.js reactjs heroku


    【解决方案1】:
    app.listen(process.env.PORT || 3000, function(){
      console.log("app is up and running");
    });
    

    heroku 部署的服务器端口不固定。

    【讨论】:

    • 无论如何这是我的服务器端口app.listen(process.env.PORT || 3000, function(){console.log("Express server listening on port %d in %s mode", this.address().port, app.settings.env);});
    • 在heroku logs --tail 中查找错误日志并仔细检查数据库连接问题。或尝试使用端口而不是 PORT。
    • 我尝试使用端口但没有做任何更改.. 使用 mongoose 连接到数据库的正确语法是什么?
    猜你喜欢
    • 2020-05-30
    • 1970-01-01
    • 2015-09-22
    • 1970-01-01
    • 2013-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-08
    相关资源
    最近更新 更多