Install dependencies for a Discord bot
Your bot's libraries are installed for you when the server starts, from package.json on Node.js or requirements.txt on Python. This guide explains where that step happens, how to pin versions, and what to do when an install fails in the console.
6 min read · Updated Oct 21, 2026 · By GuavaHost Team
What a dependency actually is
A dependency is a library your code needs but did not write: discord.js, discord.py, a database driver, a date formatter. Your project does not contain their code. It contains a list of their names, and the package manager downloads them when the project is set up.
That list is the important file. On Node.js it is package.json, on Python it is requirements.txt, and if a library is missing from it the panel has no way of knowing your bot wants it. That is the single most common reason a bot that ran fine on your laptop crashes on its first start here.
Node.js: package.json
Run npm init -y in your project folder once, then npm install discord.js and any other library. Each install records the package under dependencies, which ends up looking something like this:
{
"name": "my-bot",
"main": "index.js",
"dependencies": {
"discord.js": "^14.16.3",
"better-sqlite3": "^11.3.0"
}
}
Upload package.json along with your code, and leave node_modules on your computer. It is large, it is full of platform specific builds, and the panel rebuilds it anyway. Hosting a Node.js (discord.js) bot has the full upload walkthrough.
If you have a package-lock.json, upload that too. It records the exact version of every package in the tree, so you get the same install here as you got locally.
Python: requirements.txt
A plain text file, one package per line:
discord.py==2.4.0
aiohttp
python-dotenv
Create it with pip freeze > requirements.txt in your project folder, or just type the lines yourself. pip freeze is thorough but noisy: it lists everything in your environment, including packages you only use for testing. A short hand written list is often cleaner.
Do not upload a local venv or .venv folder. Like node_modules, it is built for your computer and the panel makes its own. Hosting a Python (discord.py) bot covers the rest of the setup.
Where the install step happens
You do not run the install yourself. When your bot server starts, the panel reads your dependency file and installs from it before launching your code, with npm for a Node.js bot and pip for a Python bot. Then it runs your main file.
That means:
- Add a library to
package.jsonorrequirements.txton your computer. - Re-upload the file on the Files tab.
- Press Restart.
The restart triggers a fresh install, so the new library is there when your code loads. The first start after adding something big is slower while it downloads, which is normal and not a hang. Watch the Console and you will see the install output scroll past before your own startup lines appear.
If you only changed code and not the dependency list, a restart is still all you need.
Pinning versions, and when to bother
A pinned version is an exact one: discord.py==2.4.0, or "discord.js": "14.16.3" with no caret. An unpinned one lets the package manager pick the newest compatible release at install time.
Unpinned is convenient and gets you fixes for free. It also means a restart three months from now can install a version your code has never run against, and a bot that worked yesterday can break without you touching it. Libraries that move fast, and discord.js and discord.py both do, are worth pinning.
A reasonable middle ground: pin the libraries your bot's behaviour depends on, and leave the small utilities loose. If you inherited old code from a tutorial, pinning the version it was written for is usually the fastest way to make it run at all, because both discord.js and discord.py have removed things across major versions.
Native modules and build tools
Most packages are pure JavaScript or pure Python and install in seconds. A few are wrappers around C code and have to be compiled, or need a prebuilt binary that matches the system. The ones bot authors run into:
better-sqlite3,canvas,sodiumand@discordjs/opuson Node.js.Pillow,numpy,lxmlandPyNaClon Python.
Usually a prebuilt wheel or binary exists and the install is uneventful. When one does not, the install fails with pages of compiler output, and the fix is almost always to use a version that ships a prebuilt build for the running Node or Python version, or to swap the package for a pure alternative. For SQLite on Node, node:sqlite on recent Node versions avoids the compile entirely.
If your bot plays audio, note that voice support is where the heaviest native dependencies live. discord.js needs @discordjs/voice plus an encryption package, and discord.py needs discord.py[voice] and PyNaCl.
When an install fails
The Console is where the real message is. Scroll back past the final "exited" line to the install output, and read the first error rather than the last one, since everything after it is usually fallout.
| What you see | What it means |
|---|---|
Cannot find module 'discord.js' | The package is not in dependencies. Add it, re-upload, restart. |
ModuleNotFoundError: No module named 'discord' | The same thing on Python: discord.py is missing from requirements.txt. |
No matching distribution found for X | The package name is wrong or that version does not exist for this Python version. |
ERESOLVE could not resolve | Two packages want incompatible versions of a third. Loosen or update one of them. |
gyp ERR! or error: command 'gcc' failed | A native module tried to compile. Pick a version with a prebuilt build, or a different package. |
ENOSPC or No space left on device | Your disk is full, often from logs or an old backup in the file area. Clear space and retry. |
| The install is killed partway with no error | Out of memory during the install. A bigger plan, or fewer heavy packages, fixes it. |
A failed install can leave a half built dependency folder behind. If an install error keeps repeating after you have fixed the cause, delete node_modules on the Files tab and restart so the next install starts clean. The same goes for a stale package-lock.json that disagrees with a package.json you edited by hand.
Reading your Discord bot's logs and finding the error goes deeper on getting a useful message out of the console, and using the panel file manager covers editing a file in place when you just need to change one line.
Before you change the list
Take a snapshot on the Backups page before a big dependency change, especially a major version bump of discord.js or discord.py. It takes a few seconds and means a bot that will not start again is one restore away from working. Backups: creating, restoring and scheduling has the details.
Common questions
Do I need to upload node_modules or venv?
No, and you should not. Both are built for the machine that created them and can be hundreds of megabytes. Upload package.json (plus package-lock.json) or requirements.txt and let the panel build the real thing on start.
How do I add a new library to a bot that is already running?
Add the line to your dependency file on your computer, re-upload that file on the Files tab, and press Restart. The install runs automatically as the server comes back up, and the console shows it happening.
Why does my bot work locally but not on the server?
The usual answer is a library you installed locally and never added to the dependency list, so it exists on your machine and nowhere else. The second most common is a different Node or Python version, which is why pinning versions and reading the first console error are both worth the effort.
Can I install a package straight from GitHub?
Yes. npm accepts a Git URL in dependencies, and pip accepts a git+https://... line in requirements.txt. It works, but a branch can change under you without warning, so point at a tag or a commit rather than a branch if the bot matters.
Still stuck? Jump into our Discord at discord.gg/GuavaHost and the team will help you out.
- discord bots
- dependencies
- npm
- pip
- package.json
- requirements.txt
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.