Deploying Discord.js Bot to Heroku: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Here’s how I solved it

Cause

When a Heroku app starts, it will dynamically bind a port for you. However, your Discord.js bot doesn’t listen to any port.

How to solve it

  1. Create a new file named Procfile to the root directory of your node project.

  1. Add the below line to Procfile and save the file. (Replace the script to how you start the app)
worker: npm start
  1. Push it to Heroku.

  2. Disable web and enable worker in Heroku App > Resources Tab.

  1. The app should restart and work well.

有任何問題都歡迎在底下留言問我!如果我的文章有幫助到你的話,請你考慮幫我免費多按幾個讚喲 *(*´∀`*)☆

JN
JN

Knows nothing about programming.