Halloween at EpicHost: sign in to the panel, find 10 pumpkins and get a -25% code for a new service. Go to the panel

Discord bot hosting in Node.js (discord.js) 24/7

Updated 25-10-2026

A discord.js bot runs with us around the clock: no computer left on at home and no tricks to "wake up" the bot like on free platforms. Here is how to upload it and keep it in good shape.

Prepare the project

The bot needs a package.json file with its dependencies, e.g.:

{
  "name": "my-bot",
  "main": "index.js",
  "dependencies": {
    "discord.js": "14.19.0",
    "dotenv": "16.4.5"
  }
}

Do not upload the node_modules folder: the panel installs the dependencies when the bot starts.

Upload the files

Upload the files in the File manager, over SFTP (details in File manager → SFTP access) or from a Git repository you set in Server settings → Startup.

Start file and Node.js version

In Server settings → Startup point to the start file, e.g. index.js. In Environment choose the Node.js version: preferably the newest LTS version available.

The token in a .env file

Create a .env file:

DISCORD_TOKEN=your_token

and read it in the code:

require('dotenv').config();
client.login(process.env.DISCORD_TOKEN);

Do not paste the token into the code or a repository. If the token leaks, generate a new one in the Discord Developer Portal.

Slash commands

You register slash commands with a separate script, e.g. deploy-commands.js from the discord.js guide. It is enough to run it once: set it as the start file for a moment, start the bot, then put index.js back.

Updating libraries

Change the version in package.json and restart the bot. If the version does not change, delete package-lock.json and the node_modules folder, then start the bot again.

Common errors

  • An invalid token was provided: the token is out of date, put a new one in .env.
  • Used disallowed intents: turn on the needed Privileged Gateway Intents in the Developer Portal.
  • Cannot find module: add the missing library to package.json.
  • The bot is online but does not react to messages: turn on the Message Content intent in the Developer Portal and add GatewayIntentBits.MessageContent in the code.

The Event log also shows the cause of a crash. The basics (creating the bot in Discord) are in Discord bot: getting started.

Please confirm