No Start Command Could be Found
What This Error Means
Railway uses Nixpacks to analyze your application's files to generate a container image for your application.s
Seeing the No start command could be found
error means that Nixpacks was unable to automatically find an appropriate start command for your application.
A start command is a command that will be executed by Railway to run your application.
Why This Error Can Occur
By default, Railway uses Nixpacks to build and run your application. Nixpacks will try its best to find an appropriate start command for your application.
Some limited examples of start commands that Nixpacks will try are -
For Node based apps it will try to use npm start
, yarn start
, pnpm start
, or bun start
if a start script is present in your package.json
file.
For Python apps it will try to use python main.py
if a main.py
file is present, or python manage.py migrate && gunicorn {app_name}.wsgi
if a Django application is detected.
For Ruby apps it will try to use bundle exec rails server -b 0.0.0.0
if a Rails application is detected.
Failing the automatic detection, Nixpacks will return the No start command could be found
error.
Possible Solutions
Since Nixpacks was unable to find a start command, you will need to specify a start command yourself.
You can do this in the service settings under the Start Command
field.
Some common start commands for various frameworks and languages are -
Node.js
node main.js
Where main.js
is the entry point for your application, could be index.js
, server.js
, app.js
, etc.
Next.js
npx next start --port $PORT
Note: The --port
flag is needed to ensure that Next.js listens on the correct port.
Nuxt.js
node .output/server/index.mjs
This will run Nuxt.js in production mode using its built-in Nitro server.
FastAPI
uvicorn main:app --host 0.0.0.0 --port $PORT
Where main
is the name of the file that contains the app
variable from FastAPI.
Note: The --host
and --port
flags are needed to ensure that FastAPI listens on the correct host and port.
Flask
gunicorn main:app
Where main
is the name of the file that contains the app
variable from Flask.
Django
gunicorn myproject.wsgi
Where myproject
is the name of the folder that contains your wsgi.py
file.
Ruby on Rails
bundle exec rails server -b 0.0.0.0 -p $PORT
Note: The -b
and -p
flags are needed to ensure that Rails listens on the correct host and port.
Vite
serve --single --listen $PORT dist
Note: The serve
command is needed to serve the static site files and can be installed by running npm install serve
locally.
Create React App
serve --single --listen $PORT build
Note: The serve
command is needed to serve the static site files and can be installed by running npm install serve
locally.
Edit this file on GitHub