Command not found
What This Error Means
CloudStation relies on Nixpacks to analyze your application's files and generate a container image for deployment.
If you encounter a Command not found
error, it means Nixpacks was unable to automatically determine the appropriate start command for your application.
The start command is essential, as it tells CloudStation how to run your application.
Causes of the Error
By default, CloudStation utilizes Nixpacks to build and run applications. Nixpacks attempts to detect an appropriate start command based on your application's structure. However, if it fails to do so, this error will appear.
Examples of Start Command Detection
Node.js Applications
- Nixpacks looks for commands like
npm start
,yarn start
,pnpm start
, orbun start
if a start script is defined inpackage.json
.
Python Applications
- If a
main.py
file is present, Nixpacks triespython main.py
. - If a Django project is detected, it attempts
python manage.py migrate && gunicorn {app_name}.wsgi
.
Ruby on Rails Applications
- If a Rails project is detected, Nixpacks tries
bundle exec rails server -b 0.0.0.0
.
If none of these conditions are met, Nixpacks will return the Command not found
error.
How to Fix the Error
Since Nixpacks was unable to determine a start command, you need to specify it manually.
Solution:
You can define a start command in the Service Settings under the Start Command
field.
Here are common start commands for various frameworks and languages:
Node.js
node main.js
Replace main.js
with your actual entry file (e.g., index.js
, server.js
, app.js
).
Next.js
npx next start --port $PORT
The --port
flag ensures Next.js runs on the correct port.
Nuxt.js
node .output/server/index.mjs
This starts Nuxt.js in production mode using Nitro.
FastAPI
uvicorn main:app --host 0.0.0.0 --port $PORT
Replace main
with your actual Python file name.
Flask
gunicorn main:app
Replace main
with your Flask application's filename.
Django
gunicorn myproject.wsgi
Replace myproject
with the folder containing wsgi.py
.
Ruby on Rails
bundle exec rails server -b 0.0.0.0 -p $PORT
Ensures Rails listens on the correct host and port.
Vite (Static Site Deployment)
serve --single --listen $PORT dist
Install serve
with npm install serve
if necessary.
Create React App
serve --single --listen $PORT build
Install serve
with npm install serve
if necessary.
By specifying the correct start command, you can resolve this error and ensure your application runs successfully on CloudStation.
Edit this file on GitHub