discord.js Bot Hosting
A discord.js bot only stays online while its Node.js process keeps running. On Zeros Host that process runs on a server, not your laptop, so the bot stays connected to Discord around the clock and restarts by itself if it crashes.
You upload your project or point the panel at a Git repository. Every start runs npm install from your package.json, so new dependencies are picked up without any manual steps.
- Node versions
- 18, 20 and 22
- Entry file
- index.js (you can change it)
- Dependencies
- npm install on every start
- Deploy
- Upload, or Git with pull on restart
A bot that runs here as it is
A minimal discord.js v14 bot. Add "discord.js": "^14" to the dependencies in package.json.
const { Client, Events, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, (c) => {
console.log(`Ready as ${c.user.tag}`);
});
client.on(Events.InteractionCreate, async (interaction) => {
if (interaction.isChatInputCommand() && interaction.commandName === 'ping') {
await interaction.reply('Pong');
}
});
client.login(process.env.DISCORD_TOKEN);How to host a discord.js bot on Zeros Host
- 1
Create the bot in the Discord Developer Portal
Go to discord.com/developers/applications, create an application, open the Bot tab and press Reset Token to copy your token. Under OAuth2, pick the bot and applications.commands scopes, choose the permissions your bot needs, and open the generated link to add the bot to your server.
- 2
Create a Node.js bot server
Start a free trial or pick a Discord Bot plan and choose Node.js. The server comes up with a small starter bot so you can see it working straight away.
- 3
Add your bot token
Open the Startup page for your server and paste your token into Discord Token. The panel passes it to your bot as the DISCORD_TOKEN environment variable, so it never has to sit inside your code or your Git repository.
- 4
Upload your code or connect Git
Upload index.js and package.json in the File Manager, or set Git Repository on the Startup page to your repo URL (and Git Branch if it is not the default) and reinstall. With Git set, every restart pulls your latest commit first.
- 5
Set the entry file if it is not index.js
If your bot starts from another file, such as src/bot.js, set Bot Main File on the Startup page to that path.
- 6
Start it and watch the console
Press Start. The console shows npm installing your dependencies and then your own logs. When you see your ready message, the bot is online in Discord.
Common discord.js errors and fixes
Cannot find module 'discord.js'
discord.js is missing from dependencies in package.json, or it is under devDependencies. Production installs skip devDependencies, so move it into dependencies and restart.
Dependency install failed on start
The console stops with a note to check package.json. Usually the file has a syntax error or a package version that does not exist. Fix package.json and restart.
SyntaxError: Cannot use import statement outside a module
Your code uses import syntax. Add "type": "module" to package.json, or rename the file to .mjs and set Bot Main File to match.
The bot logs in but slash commands never appear
Slash commands have to be registered with Discord. Register them once per guild for instant updates while you build, or globally when you are done (global commands can take a while to show). Make sure the invite link included the applications.commands scope.
Used disallowed intents
Your code asks for a privileged intent (Message Content, Server Members or Presence) that is switched off for your bot. Turn it on under Bot, Privileged Gateway Intents in the Developer Portal, or remove it from your code.
An invalid token was provided
The token in Discord Token is wrong or was reset. Reset it in the Developer Portal, paste the new one on the Startup page and restart. Discord also resets tokens it finds in public GitHub repositories, so keep yours out of your code.
Which plan fits
A discord.js bot in a handful of servers usually sits well under 256 MB. Bots in many servers, or bots that cache lots of members and messages, grow from there. Standard at 512 MB suits most discord.js bots with room to spare.
Starter
£1/mo
256 MB RAM · 5 GB
Standard
£3/mo
512 MB RAM · 10 GB
Suggested for this bot
Pro
£5/mo
1 GB RAM · 15 GB
Enterprise
£6/mo
2 GB RAM · 25 GB
Try it free for 48 hours
Start a 48-hour Discord bot trial with no card needed. Pick your runtime and your server is ready in seconds. Plans start at £1 a month after that.
Frequently asked questions
Which Node.js version does my bot run on?
You can pick Node 18, 20 or 22 on the Startup page. discord.js v14 needs Node 16.11 or newer, so all three work. Node 22 is a good default for new bots.
Do I need to run npm install myself?
No. Every start runs npm install from your package.json, so a new dependency only needs adding to package.json and a restart.
Can I deploy from a private GitHub repository?
Public repositories work out of the box. For a private one, upload the code with the File Manager or SFTP instead.