Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Laravel says Vite manifest not found at public/build/manifest.json

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

Short answer

Laravel's @vite directive looks for a running dev server first, then for a built manifest file. If neither exists you get this error. Run npm run dev while developing, or npm install and npm run build before you deploy. Tests need withoutVite(), and a custom build directory must match on both sides.

  • Applies to Laravel 12, Vite 8, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check whether a build exists and whether a dev server is meant to be running. The listing tells you which of the causes below you are in.

    ls -la public/build public/hot
  2. 2Match what you see, then jump to its fix

    1. 1public/build is missing or has no manifest file, and no dev server is runningAssets were never built for this environmentFix
    2. 2The page works in the browser, but a feature test that renders a view fails with the exceptionThe error appears only when running testsFix
    3. 3public/build is absent but another folder such as public/bundle holds the filesA custom build directory or manifest name does not matchFix

What does the error look like?

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

Cause 1 of 3

Assets were never built for this environment

1Check

A fresh clone, a new server or a Docker image does not contain compiled assets. Laravel's docs say the dev server serves assets while you work and that the build command produces the versioned files for production.

ls public/build

2Fix

Install the frontend packages, then build once. In development you can run the dev server instead and leave it running.

npm install
npm run build
# or, for local work only:
npm run dev

3Verify

The build folder now holds the manifest, and the page loads.

ls public/build

Confirmed by laravel.com

Did this fix it?

Cause 2 of 3

The error appears only when running tests

1Check

While tests run, Laravel's Vite integration tries to resolve your assets, so it needs either the dev server or a build.

grep -rn "withoutVite" tests/ | head

2Fix

Call withoutVite() in the test, or once in setUp() of your base TestCase, so Vite is mocked.

// tests/TestCase.php
protected function setUp(): void
{
    parent::setUp();

    $this->withoutVite();
}

3Verify

Run the failing test again.

php artisan test

Confirmed by laravel.com

Did this fix it?

Cause 3 of 3

A custom build directory or manifest name does not match

1Check

The directory and manifest file name can be changed in vite.config.js (buildDirectory and build.manifest). If the Blade side still uses the defaults, Laravel looks in the wrong place.

grep -n -E "buildDirectory|manifest" vite.config.js
grep -rn "useBuildDirectory\|useManifestFilename" app/ resources/

2Fix

Make both sides agree: either remove the custom values, or pass the same build directory to the @vite directive or to Vite::useBuildDirectory().

// vite.config.js
laravel({
    input: ['resources/js/app.js'],
    buildDirectory: 'bundle',
}),

{{-- Blade --}}
@vite('resources/js/app.js', 'bundle')

3Verify

Rebuild and reload the page.

npm run build

Confirmed by laravel.com

Did this fix it?

How do I stop it coming back?

  • Put npm ci and npm run build into the deploy script, before the release goes live.
  • Call withoutVite() in the base test case if your tests do not need real assets.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.