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 startif a start script is defined inpackage.json.
Python Applications
- If a
main.pyfile 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.jsReplace main.js with your actual entry file (e.g., index.js, server.js, app.js).
Next.js
npx next start --port $PORTThe --port flag ensures Next.js runs on the correct port.
Nuxt.js
node .output/server/index.mjsThis starts Nuxt.js in production mode using Nitro.
FastAPI
uvicorn main:app --host 0.0.0.0 --port $PORTReplace main with your actual Python file name.
Flask
gunicorn main:appReplace main with your Flask application's filename.
Django
gunicorn myproject.wsgiReplace myproject with the folder containing wsgi.py.
Ruby on Rails
bundle exec rails server -b 0.0.0.0 -p $PORTEnsures Rails listens on the correct host and port.
Vite (Static Site Deployment)
serve --single --listen $PORT distInstall serve with npm install serve if necessary.
Create React App
serve --single --listen $PORT buildInstall 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