Skip to content
FR
  1. LuzineDebug
  2. PHP & Laravel
  3. Vite manifest not found at: /var/www/public/buil…
PHP & Laravel Beginner ≈ 5 min to fix

Fix "Vite manifest not found at: public/build/manifest.json" in Laravel

Error message
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.
In short

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.

Be the first to confirm this fix

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

  1. Assets never built: freshly cloned project, npm install and npm run build never run.
  2. Vite server stopped locally: npm run dev is not running and no build exists.
  3. Build step missing from deployment: CI or the server does not run npm run build, or public/build is not copied into the Docker image or deployed archive.
  4. Misaligned configuration: file passed to @vite missing from input in vite.config.js, custom buildDirectory, or laravel-vite-plugin too old for the Vite version (manifest written to public/build/.vite/).

Step-by-step fix

  1. Check what exists

    Look at whether public/hot or public/build/manifest.json exist. On Windows, use dir public in PowerShell.

    bash
    ls public/hot public/build/manifest.json
  2. In development: start Vite

    Install the dependencies then start the dev server, and leave it running in its terminal. On Laravel 11+, composer run dev starts the PHP server, queue, logs and Vite at once.

    bash
    npm install
    npm run dev
    
    # Laravel 11+
    composer run dev
  3. Without a dev server: build the assets

    npm run build creates public/build/manifest.json and the built files. That is what you need in production, staging and to test the site without running Vite.

    bash
    npm ci
    npm run build
  4. 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 any public/hot left on the server, otherwise Laravel will look for the Vite server.

    dockerfile
    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
  5. Check vite.config.js and versions

    Every file passed to @vite must be listed in input, otherwise you get "Unable to locate file in Vite manifest". Also update laravel-vite-plugin if you upgraded Vite.

    javascript
    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,
            }),
        ],
    });
  6. Tests: do without Vite

    In feature tests, withoutVite() replaces @vite with empty output: CI no longer needs to build assets to test pages.

    php
    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 build to your deployment script or CI pipeline, right after composer install.
  • Keep /public/build and /public/hot in .gitignore so you never commit a stale build or a hot file.
  • Update vite and laravel-vite-plugin together, 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

All PHP & Laravel errors →