Unable to Locate File in Vite Manifest in Laravel: 7 Causes and Fixes
Raheel Shan
March 20th, 2025 · 6 min read
Laravel throws Unable to locate file in Vite manifest: resources/css/app.css when @vite() asks for a file that is not listed in public/build/manifest.json. The file name in the message may be your own file or one that belongs to a package, which is why this error wastes so much time. Work through the causes below in order; the first three solve most cases.
Quick answer
- Run
npm install && npm run build(or keepnpm run devrunning). - Make sure the path in
@vite([...])is also listed ininputinvite.config.js. - Run
php artisan view:clearand reload.
If the error still shows, one of the causes below applies.
Cause 1: The build was never run (or public/build is missing)
In production there is no dev server. Vite writes public/build/manifest.json only after npm run build. If you deploy without building, or your deploy script wipes public/build, every @vite call fails.
Fix: run npm run build in CI or locally and make sure public/build reaches the server. Check that public/build/manifest.json exists and contains the file named in the error.
Cause 2: The file is in @vite() but not in vite.config.js
The manifest only lists files that Vite was told to build.
// vite.config.js
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
@vite(['resources/css/app.css', 'resources/js/app.js'])
Every path in @vite must appear in input, spelled the same. Then rebuild.
Cause 3: The dev server is not running (local)
With a public/hot file present, Laravel expects npm run dev to be running. If you stopped the server and the hot file stayed behind, delete public/hot or restart npm run dev.
Cause 4: Wrong file in the error: resources/sass/app.scss
The same error appears for resources/sass/app.scss after upgrading or copying an old layout. Either add the file to input, or change the layout to the file you really use (usually resources/css/app.css).
Cause 5: Filament or another package theme (resources/css/filament/admin/theme.css)
Filament custom themes are separate entry points. Add the theme to input in vite.config.js and run npm run build. Same for any package that ships its own Vite entries.
Cause 6: A package expects assets you have not installed
This was my case. The error named resources/css/app.css, a file that existed in my project, so I kept checking the wrong place. The missing file was vendor/lakm/laravel-comments/resources/css/app.css. The package needs one setup command:
php artisan commenter:install
After that the error disappeared. If you installed a package that renders Blade components or Livewire UI, read its install section and look in vendor/<package>/resources for the file in the message.
Cause 7: Docker, a custom public directory or a stale cache
- Docker / CI: the container must contain
public/build. Build in an image stage and copy it in; a bind mount can hide it. - Custom public path: if your public folder is not
public, tell Vite and Laravel:Vite::useBuildDirectory()andpublicDirectoryinvite.config.js. The errorVite manifest not found at: /var/www/html/public/build/manifest.jsonmeans Laravel looked in a folder that does not have it. - Stale cache: run
php artisan optimize:clear, thennpm run build.
Debugging checklist
- Open
public/build/manifest.json. Is the file from the error listed as a key? If no, it is a build orinputproblem (causes 1, 2, 4, 5). If yes, it is a path or cache problem. - Is the error path in your project, or inside
vendor/? Check both. - Does
public/hotexist while no dev server runs? - Did you install a package that needs an
installorpublishcommand? - Reinstall:
composer installandnpm install, thennpm run build.
FAQ
Why does the error name a file that exists? Vite looks the file up in the manifest, not on disk. A file that exists but was not built is "missing".
Do I need npm run build on every deploy? Yes, unless you commit public/build. Build once per release.
What is the manifest? public/build/manifest.json maps your source files to the hashed files Vite built. Laravel's @vite reads it to print the right <link> and <script> tags.
Can I avoid the build step? For small interfaces, often yes. Server-rendered HTML with HTMX needs no bundler, see Laravel Blade partials with HTMX. The thinking behind it is in I'm SO Looking Forward to Not Needing a Build System Again.
Get a second pair of eyes on your code
We open your repository together. I review structure, queries, security and naming.
You leave with fixes you can apply the same day.
Found this useful?
Support the work that goes into these posts.