AnikBotHosting Kunden erhalten extra Resourcen. Meldet euch im Ticketsupport

› Cannot find module

A typical mistake that keeps happening. But in this post, I'll explain to you how you can fix it!


1. Keep an eye out for an error message like that in the console

hostleu@tutorial-js-8b3fd3 ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
Pulling from parkervcp/yolks
Status: Image is up to date for ghcr.io/parkervcp/yolks:nodejs_24
Digest: sha256:013b89141ca721adf0e2cc076a89e56411bf3352d2bb2a516c830d0a80a2ee5b
[pelican Daemon]: Finished pulling Docker container image
v24.21.0
:/home/container$ if [[ -d .git ]] && [[ ${AUTO_UPDATE} == "1" ]]; then git pull; fi; if [[ ! -z ${NODE_PACKAGES} ]]; then /usr/local/bin/npm install ; fi; if [[ ! -z ${UNNODE_PACKAGES} ]]; then /usr/local/bin/npm uninstall ; fi; if [ -f /home/container/package.json ]; then /usr/local/bin/npm install; fi; if [[ "${MAIN_FILE: -3}" == ".ts" ]]; then /usr/local/bin/npx ts-node --esm "/home/container/index.js" ; else /usr/local/bin/node "/home/container/index.js" ; fi
node:internal/modules/cjs/loader:1568
throw err;
^
Error: Cannot find module '/home/container/index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1564:15)
at wrapResolveFilename (node:internal/modules/cjs/loader:1118:27)
at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1142:10)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1169:12)
at Module._load (node:internal/modules/cjs/loader:1341:5)
at wrapModuleLoad (node:internal/modules/cjs/loader:261:19)
at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
at node:internal/main/run_main_module:33:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v24.21.0
hostleu@tutorial-js-8b3fd3 ~ Server marked as offline...
[pelican Daemon]: ---------- Detected server process in a crashed state! ----------
[pelican Daemon]: Exit code: 1
[pelican Daemon]: Out of memory: false
[pelican Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.

2. Solution

Change the file name of your main file to:

index.js
Last updated