7 months ago
Im deploying a vite react frontend, but deployment is failing even after successful build creation. No deploy logs are shown
1 Replies
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:
-
Make sure the selected service's Root Directory contains the Vite
package.jsonandvite.config.*file. -
Keep a normal build script:
{ "scripts": { "build": "vite build" } } -
Remove any custom Railway Start Command such as
npm run dev,vite, orvite preview. -
Remove
RAILPACK_NO_SPAif it is set. If Vite writes somewhere other than the defaultdist, setRAILPACK_SPA_OUTPUT_DIRto the actual output directory. -
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:
- https://railpack.com/languages/node/#static-sites
- https://docs.railway.com/guides/spa-routing-configuration
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.