ACLClouds
ACLClouds

Error: the startup file is missing

Match the actual file name with the startup variable without moving the entire project. Open Files and confirm the correct case.

The messages Cannot find module, can’t open file or No such file or directory often appear when the panel searches for index.js, main.py or a file located in a different subfolder.

Step-by-step procedure

  1. Read the requested path

    In the first error line, note the exact path attempted by Node.js or Python.

  2. Check files

    Open Files and confirm the correct case: Bot.js and bot.js are different under Linux.

  3. Correct the variable

    In Startup, replace the file with src/index.js, app.py or the actual relative path.

  4. Relaunch and check

    Start then verify that the console goes beyond the main file loading stage.

Example paths

Node.js: src/index.js
Python:  bot/main.py
Java:    build/libs/app.jar

Where the bot looks for its file

On the ACLClouds bot platform, the bot files live in /app, the root you see in Files. The path of the main file is relative to that root: write src/index.js, without /app/ or /home/container/ in front.

This path is set in Startup: the MAIN_FILE variable for Node.js, used by the node {{MAIN_FILE}} command, and the PY_FILE variable for Python, used by python -u {{PY_FILE}}. If the variable keeps its default value (index.js or app.py) while your file has another name, the bot stops as soon as it starts, with one of these lines:

  • Node.js: Error: Cannot find module '/app/index.js', followed by code: 'MODULE_NOT_FOUND';
  • Python: python: can't open file '/app/app.py': [Errno 2] No such file or directory.

The “Fix it” button in the console

When the console recognises this error, it opens the “Start file not found” window with the name it looked for. “Fix it” scans the root and two levels of sub-folders, picks the file to run, saves it in Startup and restarts the bot. Nothing changes until you click it.

The file is chosen in this order: for Node.js, the one declared by main or by the start script in package.json; then a file with the same name as the missing one, for example inside the folder created by an archive; finally a usual name (index.js, bot.js, main.js, app.js, src/index.js, or main.py, bot.py, app.py). If nothing fits, an “Open Files” button replaces “Fix it”.

Check after the fix

On the next start, the console shows the command actually run, for example $ node src/index.js or $ python -u bot/main.py. Compare this path with Files, including letter case. The lines that follow should come from your own code, such as the Discord connection message.

Don't rename randomly

Also check imports, package.json scripts and configuration files that use the old path.

Frequently asked questions

The console shows Cannot find module although my file exists: why?

Compare the path shown after /app/ with the tree in Files. The usual causes are a capital letter (Index.js), another extension (.mjs, .ts) or a file stored in a folder such as my-bot-main/ after extracting a GitHub archive. Fix the variable rather than moving the files one by one.

My project is in TypeScript: what goes in MAIN_FILE?

You can point to the source file, for example src/index.ts: the platform runs .ts files with tsx. If you run the compiled code, enter dist/index.js and check that this folder exists in Files. A dist folder excluded by .gitignore has to be built with npm run build or uploaded separately.

I changed MAIN_FILE but the bot still runs the old file: what should I do?

The variable applies on the next start: restart the bot from the console. If the startup command was edited by hand and no longer contains {{MAIN_FILE}}, the variable is not read any more. Fix the command with “Edit”, or click “Reset all” and set MAIN_FILE again.