Deployment failed after successful build
midhunreal1
FREEOP

7 months ago

Im deploying a vite react frontend, but deployment is failing even after successful build creation. No deploy logs are shown

$10 Bounty

1 Replies

youkamii
FREETop 5% Contributor

15 days ago

A successful Vite build only creates static files; it does not create a long-running web process by itself. On current Railway/Railpack, the simplest production setup is to let static-site detection serve the dist directory with Caddy.

Use this configuration:

  1. Make sure the selected service's Root Directory contains the Vite package.json and vite.config.* file.

  2. Keep a normal build script:

    
    {
    
      "scripts": {
    
        "build": "vite build"
    
      }
    
    }
    
  3. Remove any custom Railway Start Command such as npm run dev, vite, or vite preview.

  4. Remove RAILPACK_NO_SPA if it is set. If Vite writes somewhere other than the default dist, set RAILPACK_SPA_OUTPUT_DIR to the actual output directory.

  5. Redeploy from the latest commit.

Railpack detects Vite static builds, runs the build script, and serves the output using Caddy. It defaults to dist and provides SPA fallback routing:

Do not use Vite's development server as the production service. You also do not need to install a separate serve package for the standard static deployment.

If it still fails before any deploy log is created, post the final 30 lines of the build log, the deployment status shown in Railway, the Root Directory value, and whether a custom Start Command is still present. Do not include environment-variable values. Those four details distinguish a missing packaged output from a platform container-start failure.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...