Article Background
Back to Knowledgebase

How to Install Discord.js on Your Discord Bot Hosting Server

Discord Bots
Cubes Support
July 20, 2026

Building a custom Discord bot using Discord.js gives you total control over slash commands, moderation bots, music playback, and automated community tools.

This guide will show you how to initialize your Node.js environment, install discord.js (and additional npm packages), and launch your bot using the Cubes Hosting Game Panel.


Step 1: Set Startup Parameters to Bash / Terminal Mode

To run npm commands directly on your server, first switch your startup mode to a interactive shell terminal:

  1. Log in to your Cubes Hosting Game Panel and select your Discord bot server.
  2. Navigate to Configuration > Startup Parameters on the left menu.
  3. Set your primary executable or startup command to bash (or shell terminal mode).
  4. Click Start on your server Console.

Step 2: Initialize Node.js (npm init -y)

Once your server terminal is online in the Console:

  1. Open the Console tab on the left menu.
  2. In the terminal command input bar at the bottom, type:
    npm init -y
    
  3. Press Enter. Node Package Manager will automatically generate a clean package.json file in your root server directory.

Step 3: Install Discord.js and NPM Packages

Now install discord.js directly into your server environment:

  1. In the console command bar, type:
    npm install discord.js
    
    (Or npm i discord.js for short).
  2. Press Enter and wait a few seconds while npm downloads the Discord.js library.

Installing Additional Packages: You can install any other npm package your bot requires (such as dotenv, @discordjs/voice, mongoose, or axios) using the same command:
npm install dotenv mongoose


Step 4: Configure Your Bot's Entry Point

Once your packages have finished installing:

  1. Click Stop (or Kill) to turn off your server.
  2. Go back to Configuration > Startup Parameters.
  3. Change your startup command from bash back to Node.js:
    node index.js
    
    (Replace index.js with your main bot filename if it is named bot.js or app.js).

Step 5: Upload Your Bot Code & Launch

  1. Open your Game Panel File Manager (or connect via SFTP).
  2. Upload your bot's .js files (like index.js), configuration files, and .env file into the main root directory.
  3. Open your Console and click Start!

Your Discord.js bot will boot up, connect to Discord's gateway API, and shine online in your Discord server!



Conclusion

Installing discord.js on Cubes Hosting takes less than two minutes. Initialize Node with npm init -y, install discord.js via the console, upload your code, and watch your bot come to life!

Special Offer

Ready to Start Your Server?

Get 10% OFF your first month on any server with promo code CUBES10 at checkout!

24/7 Assistance

Need Help With Your Server?

Already a Cubes Hosting customer and couldn't find your answer? Our dedicated support team is available 24/7.