› 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.
[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.
hostleu@tutorial-python-a27dcb ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
Pulling from parkervcp/yolks
Digest: sha256:e49768d2701ea6d9ee12531b261a846492b111556ee114e32168373c598844cc
Status: Image is up to date for ghcr.io/parkervcp/yolks:python_3.14
[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 directory
hostleu@tutorial-python-a27dcb ~ 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]: Pulling Docker container image, this could take a few minutes to complete...
Pulling from parkervcp/yolks
Digest: sha256:e49768d2701ea6d9ee12531b261a846492b111556ee114e32168373c598844cc
Status: Image is up to date for ghcr.io/parkervcp/yolks:python_3.14
[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 directory
hostleu@tutorial-python-a27dcb ~ 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-82d32f ~ Server marked as starting...
[pelican Daemon]: Pulling Docker container image, this could take a few minutes to complete...
Pulling from parkervcp/yolks
Digest: sha256:04789d6917a837e6046610718690f88c1fb2836d3ee1705a9928998213e44d39
Status: Image is up to date for ghcr.io/parkervcp/yolks:java_25
[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.jar
hostleu@tutorial-java-82d32f ~ 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]: Pulling Docker container image, this could take a few minutes to complete...
Pulling from parkervcp/yolks
Digest: sha256:04789d6917a837e6046610718690f88c1fb2836d3ee1705a9928998213e44d39
Status: Image is up to date for ghcr.io/parkervcp/yolks:java_25
[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.jar
hostleu@tutorial-java-82d32f ~ 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
app.py
server.jar