【发布时间】:2020-11-29 22:45:52
【问题描述】:
我正在尝试在 heroku 上部署一个不和谐机器人。它工作大约 1-2 分钟,然后出现错误:
2020-08-10T10:05:17.228802+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-08-10T10:05:17.246146+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-08-10T10:05:17.307500+00:00 heroku[web.1]: Process exited with status 137
2020-08-10T10:05:17.347445+00:00 heroku[web.1]: State changed from starting to crashed
(完整日志):
2020-08-10T10:04:19.372794+00:00 app[web.1]:
2020-08-10T10:04:19.372804+00:00 app[web.1]: > arepee-bot@1.0.0 start /app
2020-08-10T10:04:19.372804+00:00 app[web.1]: > node index.js
2020-08-10T10:04:19.372804+00:00 app[web.1]:
2020-08-10T10:04:20.468443+00:00 app[web.1]: Bot [welcomeMessage.js] is ready!
2020-08-10T10:04:30.643838+00:00 app[web.1]: Bot [index.js] is ready!
2020-08-10T10:05:17.228802+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-08-10T10:05:17.246146+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-08-10T10:05:17.307500+00:00 heroku[web.1]: Process exited with status 137
2020-08-10T10:05:17.347445+00:00 heroku[web.1]: State changed from starting to crashed
package.json 中的start 命令为:node index.js
Procfile 是:
worker: node index.js
而index.js 是:
const Discord = require("discord.js")
const client = new Discord.Client()
const welcomeMessage = require("./welcomeMessage")
client.on("ready", () => {
console.log("Bot [index.js] is ready!")
})
client.login(process.env.TOKEN)
我还有另一个文件,welcomeMessage:
const Discord = require("discord.js")
const client = new Discord.Client()
client.on("ready", () => {
console.log("Bot [welcomeMessage.js] is ready!")
})
client.on('guildMemberAdd', member => {
let welcomeChannel = client.channels.cache.get('0000000000000')
welcomeChannel.send("hello world")
})
client.login(process.env.TOKEN)
是什么导致了这个问题?谢谢
【问题讨论】:
标签: node.js heroku discord.js