Laravel: Vite Manifest Not Found in CI
Laravel's @vite directive reads public/build/manifest.json to resolve hashed asset paths. When CI renders a view before npm run build, the manifest does not exist and Laravel throws "Vite manifest not found" (or "Unable to locate file in Vite manifest").
What this error means
A view-rendering test or page in CI fails with "Vite manifest not found at: .../public/build/manifest.json" or "Unable to locate file in Vite manifest". The Node build step did not run before the PHP step.
Illuminate\Foundation\ViteManifestNotFoundException:
Vite manifest not found at: /app/public/build/manifest.json
at vendor/laravel/framework/src/Illuminate/Foundation/Vite.php:...Common causes
Assets were not built before the PHP step
The @vite directive needs public/build/manifest.json, which only exists after npm run build. Running PHP first means it is missing.
The manifest is gitignored and not produced
public/build/ is a build artifact (gitignored). Without the Node build step, CI never creates the manifest.
How to fix it
Build Vite assets before running PHP
npm ci
npm run build # writes public/build/manifest.json
php artisan testUse Vite dev-server detection or skip in tests
For backend-only tests, avoid rendering @vite views, or run the Vite build once before the suite.
// Vite::useHotFile / withoutVite() in tests that do not need assets
\$this->withoutVite();Confirm the build output path
- Check vite.config.js builds into
public/buildwith a manifest. - Order the workflow so the Node build precedes PHP view rendering.
- If on the older Mix pipeline, use the Mix manifest guide instead.
How to prevent it
- Run
npm ci && npm run buildbefore any PHP step that renders @vite views. - Use
withoutVite()in tests that do not exercise assets. - Treat
public/build/manifest.jsonas a required CI build artifact.