Railway "No start command was found": causes and the fix
Railway "No start command was found" means Railpack could not work out how to run your app. Add a start script or set a custom start command.
The answer in four sentences
Railway's "No start command was found" error means Railpack, the builder Railway uses by default, inspected your repository and could not decide which command should run the app. For Node it looks for a start script in package.json, then the main field, then an index.js or index.ts at the root; for Python it looks for a known framework or a file such as main.py. The usual causes are a package.json with only dev and build scripts, a server file with an unusual name, or code that lives in a subfolder while the service builds from the repository root. Fix it by adding a start script, or by typing a command into the Start Command field in the service settings and redeploying.
What the failed build shows
The build stops before any image is produced, so there are no deploy logs to read. The message comes from Railpack's planning step. In Railpack's source the error text is no start command was found, and Railway's own troubleshooting page titles the same failure "No start command could be found". Both mean the same thing.
Because the failure happens during planning, the install and build steps never run. A missing start command can hide other problems, such as a build script that would also have failed. Expect a second round of fixes if the repository was never deployed anywhere before.
# The error string in Railpack's source
no start command was found
# The title of Railway's troubleshooting page
No start command could be foundWhat Railpack looks for, language by language
Railpack is open source and documents its detection rules. The table lists the checks it runs before it gives up. If none of them match your repository, the plan has no start command and Railway stops the build.
| Language | Detected when | Start command it tries, in order |
|---|---|---|
| Node | package.json in the build root | start script, then the main field, then index.js or index.ts in the root |
| Node static site | Vite, Astro, CRA, Angular, React Router or a Next.js static export is detected | No command needed: Railpack serves the build output with Caddy |
| Python | requirements.txt, pyproject.toml, Pipfile or a known main file | Framework command (for example Django), then main.py, app.py, start.py, bot.py, hello.py, server.py |
| Ruby | Rails detected | bundle exec rails server -b 0.0.0.0 |
| Any | A Procfile in the root | The web process, then worker, then the first one listed |
A worked example: the API that has no start script
Take a repository called quillnote. It holds an Express API in server/app.js and a package.json with three scripts: dev runs nodemon, build compiles TypeScript into dist/, and lint runs ESLint. There is no start script, no main field and no index.js at the root. Railpack detects Node, installs the packages, and then has nothing to run.
Locally nobody noticed, because the AI agent that wrote the project always ran npm run dev. That is the most common pattern in vibecoded repositories: the development command works, and a production command was never written. Do not set npm run dev as the start command. It starts a file watcher, usually with development settings, and wastes memory in production.
The fix is one line in package.json. After the next push Railpack finds the script and the build carries on.
{
"scripts": {
"dev": "nodemon server/app.ts",
"build": "tsc -p .",
"start": "node dist/server/app.js"
}
}Choose the fix that matches your repository
| Your situation | Best fix |
|---|---|
Node app with dev and build but no start | Add a start script to package.json |
Server file is server.js, app.js or inside src/ | Add a start script, or set main to that file |
App lives in a subfolder such as api/ | Set the service's Root Directory to /api first, then check its package.json |
| Vite or React app whose config was customised | Set RAILPACK_SPA_OUTPUT_DIR to the output folder, or set a start command that serves it |
| Python app with a different entry file | Set a start command such as uvicorn main:app --host 0.0.0.0 --port $PORT |
| You cannot change the repository | Type the command in the service's Start Command field |
Three places to set the command
The first is the service settings in the dashboard. Open the service, go to Settings and fill in the Start Command field. Railway's docs say that with Railpack this command runs in a shell, so $PORT and other variables expand without any wrapping. The change is staged, so review it and press Deploy.
The second is the RAILPACK_START_CMD variable, set on the service's Variables tab. Railpack reads it as the command to run when the container starts. It is handy when you script service creation and would rather not touch settings.
The third lives in the repository: a railpack.json file at the root of the build directory, with the command under deploy.startCommand. That keeps the command next to the code, which helps when an AI agent edits the project later and needs to see how it runs.
{
"$schema": "https://schema.railpack.com",
"deploy": {
"startCommand": "node dist/server/app.js"
}
}About railway.json and Procfiles
Older guides put the start command in railway.json or railway.toml. Railway now marks that Config as Code format as deprecated. New services cannot opt into it, and Railway says existing files stop being read on 1 January 2027. The replacement is Infrastructure as Code, a .railway/railway.ts file managed with railway config plan and railway config apply. For a single command, the dashboard field or railpack.json is simpler.
A Heroku-style Procfile still works: Railpack reads it and prefers the web process. Railpack's docs call Procfiles deprecated, though, and recommend RAILPACK_START_CMD or railpack.json instead.
Start commands that work on Railway
Whatever you choose, the command must start a production server that listens on the PORT variable Railway injects, on host 0.0.0.0. These are the commands Railway's troubleshooting page suggests for common stacks.
- Plain Node:
node main.js, with your real entry file in place ofmain.js. - Next.js:
npx next start --port $PORT. - Nuxt:
node .output/server/index.mjs, which runs the built Nitro server. - FastAPI:
uvicorn main:app --host 0.0.0.0 --port $PORT. - Flask:
gunicorn main:app. Django:gunicorn myproject.wsgi. - Rails:
bundle exec rails server -b 0.0.0.0 -p $PORT. - Vite or Create React App:
serve --single --listen $PORT dist(orbuild), after adding theservepackage.
When the repository has a Dockerfile
Railway's docs say it always builds with a Dockerfile if it finds one. In that case Railpack is not involved and this error does not appear. The start command defaults to the image's ENTRYPOINT and CMD. If you override it in settings, Railway runs it in exec form, which does not expand variables, so wrap it: /bin/sh -c "exec node dist/server/app.js --port $PORT".
Nixpacks, Railway's earlier builder, also failed with a no-start-command message, and much of the advice online was written for it. Railway's current builder docs list only Railpack and Dockerfile. The Railpack rules above are the ones that apply to a new service.
Confirm the fix and keep it fixed
Push the change or redeploy. The build log should now pass the planning step, run your build script and then show the deploy starting. Open the deploy logs and look for your server's own start-up line, for example listening on 0.0.0.0:8080. Then open the service's Railway domain.
If the build succeeds and the page returns a 502 instead, the command runs but the server is not reachable: check PORT and 0.0.0.0 first. A health check that times out on a slow first boot is a separate failure with its own log lines.
To keep the error away, ask your coding agent to write a start script whenever it creates a server, and check package.json before the first deploy. Shipyard's build prompt tells the agent that npm run build runs at build time and npm run start at boot, so the start script is part of the brief from the first session.
Sources
- Railway docs: No Start Command Could be Founddocs.railway.com
- Railway docs: Build and Start Commandsdocs.railway.com
- Railway docs: Set a Start Commanddocs.railway.com
- Railway docs: Railpackdocs.railway.com
- Railway docs: Config as Codedocs.railway.com
- Railway docs: Infrastructure as Codedocs.railway.com
- Railpack docs: Node.jsrailpack.com
- Railpack docs: Pythonrailpack.com
- Railpack docs: Environment variablesrailpack.com
- Railpack docs: Configuration filerailpack.com
- Railpack docs: Procfilerailpack.com
- Railpack source: core/core.gogithub.com
Launch in an hour, not a weekend
Shipyard connects your accounts once, then sets up the domain, hosting, database, email and payments for every new product.