gpt4 book ai didi

node.js - Heroku/Nodejs 无法启动,at=错误代码=H10 desc="App

转载 作者:太空宇宙 更新时间:2023-11-03 23:16:41 25 4
gpt4 key购买 nike

我知道这个问题已经被问过几次了,但我还没有找到有效的解决方案。我试图将我的 Node 服务器部署在 Heroku 上并构建成功,但日志打印以下消息。我也在使用 mongoose,并且在本地部署没有问题。

2019-02-10T22:30:09.912634+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=chatifydotcom.herokuapp.com request_id=b486e511-ff21-4166-ae1d-07bf5796691e fwd="74.196.2.211" dyno= connect= service= status=503 bytes= protocol=https

2019-02-10T22:30:10.287542+00:00 heroku[路由器]: at=错误代码=H10 desc="应用程序崩溃"method=GET path="/favicon.ico"host=chatifydotcom.herokuapp。 com request_id=18f17ca0-56df-4dfe-a560-d890a699f17f fwd="74.196.2.211"dyno= 连接= 服务= 状态=503 字节= 协议(protocol)=https

服务器.js

 const uri = process.env.MONGODB_URI || "mongodb://localhost:27017/chat"
mongoose
.connect(uri, { useNewUrlParser: true })
.then(() => console.log("MongoDB Connected"))
.catch(err => console.log(err.message))

const port = process.env.PORT || 9000
server.listen(port, () => {
console.log(`This server is over ${port}`)
})

最佳答案

我现在正在解决同样的错误。正如它所说,Heroku 错误代码 H10 本质上只是意味着应用程序崩溃了,但您需要进行更多挖掘才能找出实际问题是什么。

您可以通过从控制台在heroku dyno上启动应用程序来做到这一点:编辑:运行控制台的命令可能会有所不同,我在 Windows 上执行此操作

heroku run bash
npm start

然后您可以看到应用程序的控制台输出,以及用于故障排除的更具体的错误信息。然后您可以在此处解决或提出更具体的问题。

关于node.js - Heroku/Nodejs 无法启动,at=错误代码=H10 desc="App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54621951/

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