Cannot find module / ModuleNotFoundError
Your code needs a package that isn't installed, or a file that isn't where it expects.
These errors mean your code asked for something that isn’t there.
Error: Cannot find module 'discord.js'
ModuleNotFoundError: No module named 'discord'
If it names a package
The package isn’t installed on the server.
- Check it’s listed in your dependencies -
package.jsonfor Node.js,requirements.txtfor Python. If it isn’t, add it. - Go to Settings and click Install deps.
- Press Start again.
TipThe name you
importisn’t always the name you install.import discordcomes fromdiscord.py;from dotenv import load_dotenvcomes frompython-dotenv. Put the install name inrequirements.txt.
If it names one of your own files
For example Cannot find module '/index.js' or can't open file 'bot.py'. The file your run command points to isn’t where it says.
- Open the Files tab and check the exact name and folder of your main file.
- If you uploaded a zip, the files may be inside a subfolder - see Upload your files.
- Change the run command to match, or move the file, then press Start.
If it names a file inside a package
For example Cannot find module './build/Release/...'. A package was installed on a different computer and copied up. Delete the uploaded node_modules (or venv) folder and click Install deps so it’s built fresh on the server. See Don’t upload your dependencies.