Dependencies: package.json and requirements.txt

Discord Bots Reviewed September 6, 2026 1 min read

Your bot depends on libraries you did not write. The server has none of them until it is told which ones, and the file that tells it is the one people forget to upload.

Which file you need

LanguageFileInstalled with
Node.jspackage.jsonnpm install
Pythonrequirements.txtpip install -r requirements.txt

Generating it from what you already have

In Node, package.json already exists if you ever ran npm install with --save, which is the default. Check that every library you require or import appears under dependencies.

In Python, pip freeze > requirements.txt writes everything in your current environment. If you did not use a virtual environment, that file will contain half your system — trim it to the libraries your bot actually imports.

A minimal package.json for a discord.js bot

{
  "name": "my-bot",
  "version": "1.0.0",
  "main": "index.js",
  "type": "module",
  "dependencies": {
    "discord.js": "^14.14.1",
    "dotenv": "^16.4.5"
  }
}
Pin versions, or a future install will surprise you

"discord.js": "*" means «whatever is newest today». A major version can land between two restarts and break your bot with no change on your side. ^14 allows fixes but not breaking changes, which is what you want.

The install runs on every start

That is why the first start is slow and the rest are not — the packages are cached. If you add a dependency, adding it to the manifest and restarting is the whole process; you do not upload the library itself.

How to confirm it worked

The console shows the install completing with no ERR! lines, and the bot logs in afterwards.