Home > Mobile >  Discord bot with Heroku
Discord bot with Heroku

Time:09-05

I'm a beginner in javascript development, I've looked for several solutions but I don't know how to fix my error. I made a Discord bot, and I try to host it on Heroku. When heroku tries to start my bot, I get the error 'Cannot find module 'Discord.js', can someone help me please?

CodePudding user response:

Are you sure that you installed discord.js?

npm i discord.js

As well make sure in your Procfile you have:

worker: npm start

You can find out more about heroku in here.

CodePudding user response:

When you're launching a bot to heroku, make sure that you do the following:

  1. You have a Procfile file on your project.
  2. You have a gitignore file on your project.
  3. Your Github account is connected on your heroku.

In your Procfile should have:

worker: npm start

gitignore

node_modules
//If you used a .env for your token, you should ignore it too and add it
//to the heroku settings.

Further explanation: gitignore will ignore all your node_modules since heroku will provide your used modules for your projects.

  • Related