Smile Corp Docs
Polski
Rozwiązywanie problemów
Ta strona nie została jeszcze przetłumaczona na język polski, dlatego jest wyświetlana po angielsku.

Cannot find module / ModuleNotFoundError

Your code needs a package that isn't installed, or a file that isn't where it expects.

Zaktualizowano 12 wrz 20261 min czytania

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.

  1. Check it’s listed in your dependencies - package.json for Node.js, requirements.txt for Python. If it isn’t, add it.
  2. Go to Settings and click Install deps.
  3. Press Start again.
Wskazówka

The name you import isn’t always the name you install. import discord comes from discord.py; from dotenv import load_dotenv comes from python-dotenv. Put the install name in requirements.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.