GuavaHost
Language & currency
Client AreaGame Panel Toggle navigation
Games All Games
Minecraft JavaMinecraft BedrockMinecraft GeyserRustRuneScape: DragonwildsPalworldValheimValheim + BepInExARK: Survival EvolvedARK: Survival AscendedProject ZomboidEnshroudedDon't Starve TogetherCounter-Strike 2TerrariatModLoaderHytaleMulti-Game ServerDiscord Bot Hosting
Navigation PricingReviewsHelp CenterSupport Company About UsFAQRefer to earnSLATerms of ServicePrivacy Policy
Language & currency
Client AreaGame Panel

How to Host a Node.js (discord.js) Bot

This guide walks you through uploading a Node.js bot built with discord.js to your GuavaHost control panel, installing its dependencies from package.json, and starting it with the right command so it runs 24/7.

3 min read · Updated Sep 24, 2026 · By GuavaHost Team

Before you start

You need three things ready on your computer:

  • Your bot's code, with a main file such as index.js.
  • A package.json file that lists discord.js (and any other libraries) under dependencies.
  • Your bot token from the Discord Developer Portal.

If you do not have a package.json yet, run npm init -y in your project folder, then npm install discord.js. That creates the file and records the dependency. You do not need to upload the node_modules folder; the panel rebuilds it for you.

Step 1: Upload your bot

  1. Sign in at customer.guavahost.com, open My servers and click Manage on your bot's server.
  2. Go to the Files tab.
  3. Upload your project files, including index.js and package.json, with Upload files. You can also drag them straight onto the file list, or use SFTP with the details under Connection details on the Settings tab (SFTP is a secure way to move files between your computer and your server, and FileZilla is a good free client). To upload a whole folder with subfolders in one go, zip it, upload the zip and press Unpack next to it.
  4. Leave node_modules behind; skipping it keeps the upload small and fast.

Step 2: Point the panel at your main file

Open the Settings tab and find Startup settings. You will see your server variables. Set the main file variable (often called the bootstrap or JS file) to your entry file, for example index.js, and click Save next to it. This is the file the panel runs with node.

Step 3: Add your token safely

Still in Startup settings, paste your token into the token variable and click Save. Never hard-code it inside index.js. In your code, read it from the environment instead:

client.login(process.env.DISCORD_TOKEN);

Now your token lives in the panel, not in a file you might share or commit.

Step 4: Start the bot

Press Start at the top of the page. When the server starts, the panel sees your package.json and automatically runs npm install to download discord.js and everything else you listed, then launches your bot with node index.js. The first start takes a little longer while packages download.

Watch the Console. A healthy start ends with your own ready message, something like Logged in as YourBot#1234. If you see it, switch to Discord and your bot should show as online.

If something goes wrong

  • Cannot find module 'discord.js': the library is not in your package.json dependencies. Add it, re-upload the file, and restart so npm install runs again.
  • Used disallowed intents: enable the Gateway Intents your bot needs in the Discord Developer Portal, under your application's Bot settings, then restart.
  • An invalid token was provided: check the token variable under Startup settings for stray spaces, or regenerate the token in the Developer Portal and paste the new one.
  • SyntaxError or a crash on start: read the stack trace in the Console; it names the file and line so you can fix it.

Updating your bot later

When you change your code, re-upload the changed files on the Files tab and press Restart. If you added a new library to package.json, the restart triggers a fresh npm install automatically. Take a snapshot on the Backups page first if the change is risky, so you can restore in one click.

Still stuck? Jump into our Discord at discord.gg/GuavaHost and the team will help you out.

  • discord bots
  • node.js
  • discord.js
  • npm
  • setup

Host your Discord bot 24/7 From $1.50/mo, with instant setup and DDoS protection.

Still need help? Our team is online 24/7 to answer questions.

Contact support

Related guides

More from Discord Bots.

  • How to Host a Python (discord.py) Bot

    This guide shows you how to upload a Python bot built with discord.py to your GuavaHost control panel, install its libraries from requirements.txt, and start it so it stays online around the clock.

    3 min

  • What Is Discord Bot Hosting and How It Works

    Discord bot hosting means running your bot's code on an always-on server so it stays online 24 hours a day, even when your own computer is switched off, and on GuavaHost you run it from your control panel at customer.guavahost.com.

    3 min

  • Discord Bot Keeps Going Offline? 4 Common Fixes

    If your Discord bot keeps dropping offline, it is almost always crashing, running out of memory, hitting a token or intents problem, or simply not being hosted on an always-on server, and this guide walks through each cause and its fix.

    3 min

  • Keeping Your Discord Bot Token Secret and Safe

    Your bot token is the password to your bot, so this guide explains how to keep it secret by storing it in your panel's startup settings, never in your code, and what to do the moment it leaks.

    3 min