Laravel 9 project, Vite manifest not found on server

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company

Solving the Deployment Headache: Vite Manifest Not Found on Your Laravel Server

As a senior developer, I’ve seen countless scenarios where local development runs flawlessly, but deployment introduces cryptic errors. One of the most frustrating issues developers face when deploying modern Laravel applications—especially those leveraging asset bundlers like Vite—is the dreaded "Vite manifest not found" error on the production server.

This post will diagnose why this happens and provide a comprehensive, step-by-step solution to ensure your Laravel 9 project deploys smoothly, regardless of the environment.

Understanding the Vite Manifest Problem

The core issue stems from the difference between how Vite operates during local development and how it expects assets to be served in a production environment.

When you run npm run build, Vite compiles your source files (Sass, JavaScript, etc.) into optimized, hashed assets, placing them inside the public/build directory. Crucially, it also generates a manifest.json file that acts as a map, telling the framework exactly which entry points (like your main CSS or JS files) have been compiled and what their final hashed filenames are.

The error you are seeing:

Vite manifest not found at: /var/www/example.com/public/resources/assets/js/myScripts.js/manifest.json

tells us that the @vite() Blade directive is looking for this manifest file at a specific, expected path relative to where it is being executed on the server, and it cannot find it.

The Root Cause: Deployment Pathing Errors

The problem isn't usually that the file doesn't exist, but rather that the web server (Apache, Nginx) or the Laravel application environment cannot correctly resolve the path to the built assets, or the build output wasn't deployed to the exact location expected by the framework.

In a standard Laravel setup, the compiled Vite assets must be placed directly into the public directory for the web server to access them via the root URL. If your deployment script only copies source files or misses the final build artifacts, this error will inevitably occur.

The Solution: Ensuring Correct Asset Deployment

To resolve this, we need to ensure that the entire compiled Vite output—including the manifest.json file—is correctly transferred to the server within the public directory structure.

Here is the definitive workflow for fixing this issue on your Ubuntu server:

Step 1: Verify the Build Output Location

After running npm run build, confirm that the necessary files are present in your local project root. They should reside in public/build.

ls public/build
# You should see manifest.json and your compiled JS/CSS files here.

Step 2: Correct Deployment Strategy (The Critical Step)

When deploying, you must ensure that the contents of your local build directory are mirrored exactly into the remote location. Relying on simply copying the source code is insufficient; you must copy the built assets.

Use a robust deployment script (like those managed by CI/CD pipelines or simple rsync commands) to synchronize the entire public folder.

Example using rsync for synchronization:

# Assuming your deployed path is /var/www/example.com
rsync -avz --delete ./public/ /var/www/example.com/public/

This command ensures that the contents of your local public directory (which now contains the necessary build folder) are synchronized with the server's public directory.

Step 3: Confirming Laravel Configuration

While the deployment is key, it’s also worth double-checking your Blade file usage. The @vite() directive should generally be placed in the main layout file (resources/views/layouts/app.blade.php) and should reference the standard Vite path, which resolves correctly when the assets are properly deployed to public.

{{-- resources/views/layouts/app.blade.php --}}
@vite(['resources/assets/sass/app.scss', 'resources/assets/js/myScripts.js'])

If you are using custom asset paths, ensure they align perfectly with the structure generated by Vite and deployed to the public folder.

Conclusion

The "Vite manifest not found" error is almost always an infrastructure or deployment synchronization issue rather than a bug in the Vite build itself. By understanding that the server needs the final compiled artifacts (the contents of public/build) and ensuring your deployment process faithfully copies these built files, you can eliminate this frustrating roadblock. Mastering these deployment details is crucial when building robust applications on platforms like Laravel. For more insights into modern PHP development practices, I highly recommend exploring resources from the official team at laravelcompany.com.