我想在 Heroku 上托管我的 Discord 机器人,我做的一切都是正确的,但是当我做 git push herok



我想在 Heroku 上托管我的不和谐机器人,但当我做 git push heroku 时,它说它是 TypeError

但是当我在我的电脑上运行我的机器人时,它工作得很好......所以我不明白 heroku 有什么问题。

错误:

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```

我认为该应用程序无法绑定到给定的(硬编码? Heroku运行时为您提供了一个环境变量PORT(大写(:您应该使用它来定义应用程序的端口。

最新更新