10 months ago
Hello, since yesterday I have a problem with my projects on railway because it reads them as caddy (only static files) and it doesn't want to read the node backend, please help me.
3 Replies
10 months ago
Hey! Railway's auto-detection switched your Node backend to Caddy, which means it's not finding your Node files properly. Make sure you have a package.json in your repo root - Railway uses that to detect Node projects. If it's there but still detecting as Caddy, you can force Node by adding a nixpacks.toml file with [phases.setup] providers = ["node"] or set a custom start command in your Railway service settings. Did something change in your repo structure yesterday? Check if your package.json got moved or deleted.
10 months ago
Option 1: Adjust Root Directory (Recommended)
If your package.json is in a subfolder (e.g., /backend), tell Railway where it is:
- In your Railway service dashboard, go to Settings.
- Find the Root Directory option.
- Enter the name of your folder (e.g.,
backend). - Redeploy.
Option 2: Force Node.js Start Command
If the file structure is correct, manually force the Node.js build process:
- Go to the Settings tab of your service.
- In the Deploy section, find the Start Command.
- Set it to your Node.js start script (e.g.,
npm start).
Make sure to
- Ensure your
package.jsonis in the directory you specified. - Make sure the
package.jsonincludes a valid"start"script (e.g.,"start": "node index.js").
This worked for me so i hope it helps!
10 months ago
Hey, could you solve it? 🙂