Fix "Vite manifest not found at: public/build/manifest.json" in Laravel
Vite manifest not found at: /var/www/public/build/manifest.json
- Illuminate\Foundation\ViteManifestNotFoundException: Vite manifest not found at: /var/www/html/public/build/manifest.json
- Vite manifest not found at: C:\laragon\www\app\public\build/manifest.json
- Unable to locate file in Vite manifest: resources/css/app.css.
Laravel’s @vite directive finds neither the Vite dev server nor the built files. Locally, run npm install then npm run dev; for production, run npm run build, which creates public/build/manifest.json, and add that step to your deployment.
What this error means
The @vite(['resources/css/app.css', 'resources/js/app.js']) directive chooses between two modes. If the public/hot file exists, created by npm run dev, it points to the Vite dev server. Otherwise, it reads public/build/manifest.json, produced by npm run build, to find the names of the built files (with their hash, like app-4f3a2b.js). If neither exists, Laravel throws ViteManifestNotFoundException. The public/build folder is in .gitignore by default: it is therefore missing after every git clone until the assets are built. "Unable to locate file in Vite manifest" means the manifest exists but does not contain the requested file.
Common causes
- Assets never built: freshly cloned project,
npm installandnpm run buildnever run. - Vite server stopped locally:
npm run devis not running and no build exists. - Build step missing from deployment: CI or the server does not run
npm run build, orpublic/buildis not copied into the Docker image or deployed archive. - Misaligned configuration: file passed to
@vitemissing frominputinvite.config.js, custombuildDirectory, orlaravel-vite-plugintoo old for the Vite version (manifest written topublic/build/.vite/).
Step-by-step fix
-
Check what exists
Look at whether
public/hotorpublic/build/manifest.jsonexist. On Windows, usedir publicin PowerShell.ls public/hot public/build/manifest.json -
In development: start Vite
Install the dependencies then start the dev server, and leave it running in its terminal. On Laravel 11+,
composer run devstarts the PHP server, queue, logs and Vite at once.npm install npm run dev # Laravel 11+ composer run dev -
Without a dev server: build the assets
npm run buildcreatespublic/build/manifest.jsonand the built files. That is what you need in production, staging and to test the site without running Vite.npm ci npm run build -
Add the build to the deployment
The server or image must contain
public/build. With Docker, build in a Node.js stage and copy the result into the PHP image. Also delete anypublic/hotleft on the server, otherwise Laravel will look for the Vite server.FROM node:24-alpine AS assets WORKDIR /app COPY . . RUN npm ci && npm run build FROM php:8.4-fpm WORKDIR /var/www/html COPY . . COPY --from=assets /app/public/build ./public/build RUN rm -f public/hot -
Check
vite.config.jsand versionsEvery file passed to
@vitemust be listed ininput, otherwise you get "Unable to locate file in Vite manifest". Also updatelaravel-vite-pluginif you upgraded Vite.import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; export default defineConfig({ plugins: [ laravel({ input: ['resources/css/app.css', 'resources/js/app.js'], refresh: true, }), ], }); -
Tests: do without Vite
In feature tests,
withoutVite()replaces@vitewith empty output: CI no longer needs to build assets to test pages.public function test_home_page_loads(): void { $this->withoutVite(); $this->get('/')->assertOk(); }
Did this fix work for you?
Confirm it in one click: it will rise for the next developers stuck on the same error.
Keep it from coming back
- Add
npm ci && npm run buildto your deployment script or CI pipeline, right aftercomposer install. - Keep
/public/buildand/public/hotin.gitignoreso you never commit a stale build or ahotfile. - Update
viteandlaravel-vite-plugintogether, checking their compatibility.
Frequently asked questions
Do I need to keep npm run dev running all the time?
In development, yes: it serves the files and reloads the page. If you do not want to run it, run npm run build once, but you will need to run it again after every CSS or JavaScript change.
Why does the site load files from localhost:5173 in production?
A public/hot file was deployed or left on the server: Laravel thinks the Vite server is running. Delete it and check that it is in .gitignore.
Can I commit public/build to avoid Node.js on the server?
It is possible if your hosting has no Node.js, but you must rebuild and commit on every asset change. Building in CI and deploying the result is more reliable.
Useful tools for this error
More PHP & Laravel errors
- Fix "419 Page Expired" in Laravel (CSRF token mismatch)
- Fix "Allowed memory size of 134217728 bytes exhausted" in PHP
- Fix "Target class [X] does not exist" and "Class not found" in Laravel
- Fix "SQLSTATE[HY000] [2002] Connection refused" in Laravel
- Fix "No application encryption key has been specified" in Laravel
- Fix "Your requirements could not be resolved to an installable set of packages" (Composer)
- Fix "laravel.log could not be opened in append mode: Permission denied"