Skip to content
Kravn Hosting

FR/EN

  • The offer
  • Guide
  • FAQ
  • FR/EN
Discord Panel login Sign up
  1. Home
  2. Guides
  3. Host a discord.js bot (Node.js) for free

Host a discord.js bot (Node.js) for free

Does your bot use discord.js? On Kravn Hosting it runs 24/7 on Node.js 24 or 22, for free, with no credit card. Here is what to prepare, how to upload it and how to fix the most common errors.

Prepare your bot

  • package.json: your dependencies, and the start file in main.
  • index.js: your bot's code.
  • .env: your Discord token. It stays on the server, never put it on GitHub.

A simple package.json:

{
  "name": "my-bot",
  "main": "index.js",
  "dependencies": {
    "discord.js": "^14.16.0",
    "dotenv": "^16.4.0"
  }
}

The .env file:

DISCORD_TOKEN=your-token

A minimal index.js that answers !ping:

require('dotenv').config();
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
});

client.once('ready', () => console.log(`Logged in as ${client.user.tag}`));

client.on('messageCreate', (message) => {
  if (message.content === '!ping') message.reply('Pong!');
});

client.login(process.env.DISCORD_TOKEN);

Get it online

  1. Create your account with Discord, then log in to the panel and open your bot.
  2. Pick Node.js (24 or 22) in the Startup tab. Leave the main file empty: Kravn runs the file set in main, or index.js.
  3. Upload your files in the Files tab or over SFTP. Do not upload node_modules: it is installed on the server.
  4. Press Start. Kravn runs npm install on the first start, then only when package.json or package-lock.json changes.

Is your code on GitHub? Deploy it from GitHub, it updates on every restart.

TypeScript bots

Build your bot before uploading it (for example with tsc), then put the built file in main, for example "main": "dist/index.js". devDependencies are not installed on the server.

Common errors

  • Cannot find module: the package is missing from dependencies. If it is in devDependencies, move it and restart.
  • Used disallowed intents: in the Discord developer portal, Bot tab, enable Message Content Intent (and Server Members Intent if you use it).
  • An invalid token was provided: the token is wrong or was reset. Copy the new one into your .env.
  • Cannot use import statement outside a module: your code uses import. Add "type": "module" to your package.json.
  • The bot stops with no message: it may be out of memory. Each bot has 256 MB of RAM, enough for a normal bot.

Good to know

  • You get 256 MB of RAM, 768 MB of disk and 20% of a CPU core.
  • Only a Discord bot is allowed: a website, a proxy or any other program is stopped.
  • Your bot is paused if it stays offline for more than 5 days. Your files are kept and you start it again yourself from the panel.
  • You can switch from Node.js to Python later, in the Startup tab.

Create my account

Going further

  • Free Discord bot hosting
  • Host a Python Discord bot
  • Deploy a Discord bot from GitHub
  • Frequently asked questions
  • A question? Come to the Discord.
Kravn Hosting

Free and secure hosting for your Discord bot, online 24/7.

Join the Discord

Kravn

  • The offer
  • Panel login
  • Create an account
  • Status
  • Discord

Guides

  • Free bot hosting
  • Python Discord bot
  • discord.js bot (Node.js)
  • Deploy from GitHub
  • Ready-made bots
  • Web dashboard
  • All guides

Legal

  • Legal notice
  • Terms of use
  • Privacy

© 2026 Kravn Hosting · Free service.