[英]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.