Node.js App Crashing After Adding Backend Files
shadowteam1-begin
FREEOP

a month ago

Description of the issue:

I am trying to deploy a full-stack project via GitHub. My initial deployment was working, but after pushing my Node.js backend files to the repository, the Railway deployment now crashes immediately after building.

Error messages / Logs:

Here is the error I am seeing at the bottom of my Deploy Logs:

Error: Cannot find module '/app/server.js'

at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)

at Module._load (node:internal/modules/cjs/loader:981:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)

at node:internal/main/run_main_module:28:49 {

code: 'MODULE_NOT_FOUND',

requireStack: []

Link to GitHub repo:

https://github.com/shadowteam1-begin/BloodLinlkN

Additional Info:

I am using Node.js.

Solved

1 Replies

Railway
BOT

a month ago

Your service is looking for /app/server.js but your repo has the backend files in a backend/ subdirectory, so the file isn't at the root where the runner expects it. You need to either set the Root Directory to your backend folder in your service's Settings tab, or set a custom Start Command that points to the correct file path (e.g., node backend/server.js). See Deploying a Monorepo for details on configuring this.


Status changed to Awaiting User Response Railway 30 days ago


Railway
BOT

23 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 23 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...