› Cannot find module
Ein Typischer Fehler, welcher immer wieder vorkommt. Aber in diesem Post erkläre ich dir, wie du ihn beheben kannst!
1. Halte mal in der Console nach so einer Fehlermeldung ausschau
hostleu@tutorial-js-a20471 ~ Server marked as offline...
[pelican Daemon]: checking server disk space usage, this could take a few seconds...
[pelican Daemon]: Updating process configuration files...
[pelican Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
hostleu@tutorial-js-a20471 ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
[pelican Daemon]: Finished pulling Docker container image
v24.19.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:1520
throw err;
^
at Module._resolveFilename (node:internal/modules/cjs/loader:1517:15)
at wrapResolveFilename (node:internal/modules/cjs/loader:1071:27)
at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1095:10)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1122:12)
at Module._load (node:internal/modules/cjs/loader:1294:5)
at wrapModuleLoad (node:internal/modules/cjs/loader:255: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.19.0
hostleu@tutorial-js-a20471 ~ 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.
[pelican Daemon]: checking server disk space usage, this could take a few seconds...
[pelican Daemon]: Updating process configuration files...
[pelican Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
hostleu@tutorial-js-a20471 ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
[pelican Daemon]: Finished pulling Docker container image
v24.19.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:1520
throw err;
^
Error: Cannot find module '/home/container/index.js'at Module._resolveFilename (node:internal/modules/cjs/loader:1517:15)
at wrapResolveFilename (node:internal/modules/cjs/loader:1071:27)
at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1095:10)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1122:12)
at Module._load (node:internal/modules/cjs/loader:1294:5)
at wrapModuleLoad (node:internal/modules/cjs/loader:255: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.19.0
hostleu@tutorial-js-a20471 ~ 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.
hostleu@tutorial-python-0bd318 ~ Server marked as offline...
[pelican Daemon]: checking server disk space usage, this could take a few seconds...
[pelican Daemon]: Updating process configuration files...
[pelican Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
hostleu@tutorial-python-0bd318 ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
[pelican Daemon]: Finished pulling Docker container image
Python 3.14.8
container~ if [[ -d .git ]] && [[ "${AUTO_UPDATE}" == "1" ]]; then git pull; fi; if [[ ! -z "${PY_PACKAGES}" ]]; then pip install -U --prefix .local ; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --prefix .local -r requirements.txt; fi; /usr/local/bin/python /home/container/app.py
hostleu@tutorial-python-0bd318 ~ Server marked as offline...
[pelican Daemon]: ---------- Detected server process in a crashed state! ----------
[pelican Daemon]: Exit code: 2
[pelican Daemon]: Out of memory: false
[pelican Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.
[pelican Daemon]: checking server disk space usage, this could take a few seconds...
[pelican Daemon]: Updating process configuration files...
[pelican Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
hostleu@tutorial-python-0bd318 ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
[pelican Daemon]: Finished pulling Docker container image
Python 3.14.8
container~ if [[ -d .git ]] && [[ "${AUTO_UPDATE}" == "1" ]]; then git pull; fi; if [[ ! -z "${PY_PACKAGES}" ]]; then pip install -U --prefix .local ; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --prefix .local -r requirements.txt; fi; /usr/local/bin/python /home/container/app.py
/usr/local/bin/python: can't open file '/home/container/app.py': [Errno 2] No such file or directoryhostleu@tutorial-python-0bd318 ~ Server marked as offline...
[pelican Daemon]: ---------- Detected server process in a crashed state! ----------
[pelican Daemon]: Exit code: 2
[pelican Daemon]: Out of memory: false
[pelican Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.
hostleu@tutorial-java-298046 ~ Server marked as offline...
[pelican Daemon]: checking server disk space usage, this could take a few seconds...
[pelican Daemon]: Updating process configuration files...
[pelican Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
hostleu@tutorial-java-298046 ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
[pelican Daemon]: Finished pulling Docker container image
container~ java -version
openjdk version "25.0.4.1" 2026-08-18 LTS
OpenJDK Runtime Environment Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS, mixed mode, sharing)
container~ java -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar
hostleu@tutorial-java-298046 ~ 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]: checking server disk space usage, this could take a few seconds...
[pelican Daemon]: Updating process configuration files...
[pelican Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
[pelican Daemon]: checking server disk space usage, this could take a few seconds...
[pelican Daemon]: Updating process configuration files...
[pelican Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
hostleu@tutorial-java-298046 ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
[pelican Daemon]: Finished pulling Docker container image
container~ java -version
openjdk version "25.0.4.1" 2026-08-18 LTS
OpenJDK Runtime Environment Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS, mixed mode, sharing)
container~ java -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar
Error: Unable to access jarfile server.jarhostleu@tutorial-java-298046 ~ 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]: checking server disk space usage, this could take a few seconds...
[pelican Daemon]: Updating process configuration files...
[pelican Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
2. Lösung
Ändere den Datei Namen deines Main files zu den auwahlmöglichkeiten:
index.jsapp.pyserver.jar