Skip to main content
← Back to articles
Debugging note • Laravel production issue and solution

Laravel Vite Assets Not Loading After Deployment: Complete Production Fix Guide (2026)

Birendra Jung Rai • 6 min read

Production debugging note

This article explains the real cause of the issue, the correct fix, and the checks that help prevent the same problem from returning.

Laravel Vite Manifest Not Found After Deployment? 9 Fixes for Broken CSS and JS

Short answer: In production, Laravel does not use the Vite dev server. It reads compiled files from public/build/. If npm run build never ran, or its output never reached the server, you get a blank page, missing CSS, or this error:

Vite manifest not found at: /var/www/app/public/build/manifest.json

The fixes below also cover 404 errors on /build/assets/... and the leftover public/hot file. They apply to Laravel 12 and recent versions.

Quick check (30 seconds)

Run these on the production server, from the project root:

ls public/build/manifest.json   # must exist
ls public/hot                   # must NOT exist
  • manifest.json missing: go to Fix 1, 2 or 3.
  • public/hot exists: go to Fix 4.
  • Both are fine: go to Fix 5 to 9.

How Laravel and Vite work in production

Development:

Browser → Laravel → Vite dev server (HMR)

Production:

npm run build → public/build/ → manifest.json → Laravel → Browser

Laravel looks up each asset in manifest.json and prints the hashed file name in your page. If the manifest or the folder is missing, Laravel cannot find your assets.

Fix 1: You never ran npm run build

This is the most common cause. npm run dev is for local work only. Production needs compiled files.

npm install
npm run build

After this you should see:

public/
  build/
    assets/
    manifest.json

Upload or deploy the whole public/build folder with your app.

Fix 2: Your pipeline or Git ignored the build

Many teams add public/build to .gitignore. That is fine, but only if every deploy builds the assets itself. A common mistake is a pipeline that runs only composer install.

Make sure it also builds the frontend. Example for GitHub Actions:

- run: composer install --no-dev --optimize-autoloader
- run: npm ci
- run: npm run build

If you do not build on the server, upload the built public/build folder as part of the release.

Fix 3: Node.js is missing on the server

If you build on the server, Node.js and npm must be installed:

node -v
npm -v

If these fail, the build cannot run. Many shared hosts do not offer Node.js. In that case, build on your computer or in CI, then upload public/build.

Fix 4: A leftover public/hot file

When you run npm run dev, Vite creates public/hot. If this file exists, Laravel thinks the dev server is running and points your assets to something like http://[::1]:5173. The browser cannot reach that address, so assets fail.

rm public/hot

Keep public/hot in .gitignore (it is there by default) and never copy it to production.

Fix 5: "Unable to locate file in Vite manifest"

This error is different from "manifest not found". The manifest exists, but it does not list the file you asked for:

Unable to locate file in Vite manifest: resources/css/app.css

Check two things:

  1. The file is listed in input in vite.config.js:
laravel({
    input: ['resources/css/app.css', 'resources/js/app.js'],
    refresh: true,
}),
  1. The path in your Blade file matches it exactly, including upper and lower case. Linux paths are case sensitive.
@vite(['resources/css/app.css', 'resources/js/app.js'])

Then run npm run build again.

Fix 6: Assets return 404

If the browser shows a 404 for /build/assets/app-xxxx.js, check these:

  • Folder missing: confirm public/build/ exists on the server.
  • Wrong document root: your web server must serve from the public folder, for example /path-to-project/public. If it points to the project root, asset paths fail and sensitive files such as .env may be exposed.
  • Broken symlink: if you deploy with release folders, confirm the symlink points to the newest release.
  • Permissions: the web server user must be able to read the files.
chmod -R 755 public/build
chown -R www-data:www-data public/build   # use your server's user

Fix 7: Wrong asset URLs and mixed content

If your site uses HTTPS but assets load over HTTP, the browser blocks them. Open Developer Tools and look at the Console for "mixed content" warnings.

Common causes and fixes:

  • Behind a load balancer or proxy: Laravel may think the request is HTTP. Trust your proxy in bootstrap/app.php:
->withMiddleware(function (Middleware $middleware) {
    $middleware->trustProxies(at: '*');
})
  • Force HTTPS in AppServiceProvider:
use Illuminate\Support\Facades\URL;

public function boot(): void
{
    if (app()->isProduction()) {
        URL::forceScheme('https');
    }
}
  • Assets on a CDN or another domain: set ASSET_URL in .env.
  • Check APP_URL: it should be https://example.com, not http://localhost. It matters for links in queued jobs and emails, so keep it correct.

Fix 8: Old configuration cache

Laravel may keep using old values after you change .env. Clear the caches, then rebuild:

php artisan optimize:clear
php artisan config:cache

Fix 9: Browser cache

Sometimes nothing is broken on the server. Your browser may hold old HTML that points to files that no longer exist, because Vite gives files hashed names like app-4df87ab1.js.

Try a hard refresh, an incognito window, or clear the cache.

Production deployment checklist

  • [ ] composer install --no-dev --optimize-autoloader
  • [ ] npm ci (or npm install)
  • [ ] npm run build
  • [ ] public/build/manifest.json exists
  • [ ] public/hot does not exist
  • [ ] APP_URL is correct and uses https://
  • [ ] php artisan optimize:clear, then php artisan config:cache
  • [ ] Web server root points to public
  • [ ] public/build is readable by the web server
  • [ ] Test in an incognito window

FAQ

Why does Laravel Vite work locally but fail after deployment?

Locally, Laravel uses the Vite dev server. In production, it serves compiled files from public/build. If those files were never built or uploaded, the page cannot load them.

What does "Vite manifest not found" mean?

Laravel could not find public/build/manifest.json. Run npm run build and make sure the public/build folder is on the server.

What is the public/hot file?

Vite creates it while npm run dev runs. If it stays on the server, Laravel points assets to the dev server, and they fail to load. Delete it.

Do I need Node.js on my production server?

Not if you build assets in CI or on your computer before deploying. You need Node.js only if you build on the server.

Can I add public/build to .gitignore?

Yes, but only if every deploy runs npm run build or uploads the built files. Otherwise the app has no compiled assets.

Should I use npm run dev in production?

No. Use npm run build.

Final thoughts

Most Vite deployment problems come from a missing build step or a deploy process that differs from local work. Start simple: confirm the build exists, remove public/hot, check the URLs, and clear the caches. Then look at your browser's Network tab and your server logs.

Next in the Laravel Production Engineering series: Docker for Laravel Developers: Complete Beginner Guide. It shows how Docker reduces "works on my machine" problems.

 

 

Need help with a similar issue?

Let’s make the next technical decision clearer.

Share the problem, the relevant error, or the current system. I can help identify the practical next step.

Request a project review

Continue reading

Related Laravel fixes

View all articles →
Birendra Jung Rai

Birendra Jung Rai

Laravel Engineer • System Architect • Technical Educator