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.jsonfile that listsdiscord.js(and any other libraries) underdependencies. - 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
- Sign in at customer.guavahost.com, open My servers and click Manage on your bot's server.
- Go to the Files tab.
- Upload your project files, including
index.jsandpackage.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. - Leave
node_modulesbehind; 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.jsondependencies. Add it, re-upload the file, and restart sonpm installruns 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.