简体   繁体   English

我想在 heroku 上托管我的 discord bot,我做的一切都是正确的,但是当我执行 git push heroku 时,我在日志中收到错误

[英]i want to host my discord bot on heroku and i do everything correct but when i do git push heroku i get error in logs

I want to host my discord bot on Heroku but when i do git push heroku it says it's TypeError我想在 Heroku 上托管我的不和谐机器人,但是当我执行 git push heroku 时,它说它是 TypeError

But when i run my bot on my pc it works perfect.. so i don't understand what's problem with heroku..但是当我在我的电脑上运行我的机器人时,它工作得很好..所以我不明白heroku有什么问题..

Error:错误:

2020-01-05T11:50:17.718173+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-05T11:50:17.636956+00:00 app[web.1]: TypeError: Cannot set property 'port' of undefined
2020-01-05T11:50:17.636975+00:00 app[web.1]:     at Object.<anonymous> (/app/src/config.js:149:19)
2020-01-05T11:50:17.636977+00:00 app[web.1]:     at Module._compile (internal/modules/cjs/loader.js:959:30)
2020-01-05T11:50:17.636980+00:00 app[web.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2020-01-05T11:50:17.636982+00:00 app[web.1]:     at Module.load (internal/modules/cjs/loader.js:815:32)
2020-01-05T11:50:17.636984+00:00 app[web.1]:     at Function.Module._load (internal/modules/cjs/loader.js:727:14)
2020-01-05T11:50:17.636986+00:00 app[web.1]:     at Module.require (internal/modules/cjs/loader.js:852:19)
2020-01-05T11:50:17.636988+00:00 app[web.1]:     at require (internal/modules/cjs/helpers.js:74:18)
2020-01-05T11:50:17.636990+00:00 app[web.1]:     at Object.<anonymous> (/app/src/index.js:44:16)
2020-01-05T11:50:17.636993+00:00 app[web.1]:     at Module._compile (internal/modules/cjs/loader.js:959:30)
2020-01-05T11:50:17.636994+00:00 app[web.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2020-01-05T11:50:17.705478+00:00 heroku[web.1]: Process exited with status 1```

I think the app cannot bind to the given (hardcoded?) port and it fails.我认为该应用程序无法绑定到给定的(硬编码?)端口并且失败。 Heroku runtime provides you with an environment variable PORT (upper case): you should use that to define the port of your app. Heroku 运行时为您提供了一个环境变量 PORT(大写):您应该使用它来定义应用程序的端口。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我部署Discord Bot时出现Heroku错误 - Heroku error when i deploy my Discord Bot 运行“git push heroku master”时出现错误 - I get an error when running “git push heroku master” 部署到heroku时,如何使我的node / socket.io应用使用正确的端口? - How do I get my node/socket.io app to use the correct port when deployed to heroku? Discord bot可以很好地在本地托管,但是如果我尝试将其托管在heroku上,它会显示“错误:找不到模块&#39;discord.js&#39;” - Discord bot works fine hosted locally but if i try and host it on heroku it says “Error: Cannot find module 'discord.js'” 如何让我的 Discord 机器人发送欢迎消息? - How do I get my Discord bot to send a welcome message? 如何让我的 discord 机器人对提到的它做出反应? - How do I get my discord bot react to it being mentioned? 当我的API密钥位于.gitignore文件中时,如何从git部署到heroku? - How do I deploy to heroku from git when my API key is in a .gitignore file? 运行 discord.js 机器人时出现错误 - I get an error when running my discord.js bot 我正在尝试使用 Heroku 创建一个不和谐的机器人,当我在本地运行它时它可以工作,但是当我将它部署在 Heroku 上时它不起作用 - I'm trying to create a discord bot with Heroku, when I run it locally it works, but it doesn't work when I deploy it on Heroku 如何在Heroku上到达前端? 后端启动并运行 - How to do I get at my frontend on Heroku? The backend is up & running
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM