Laravel 9 replies "Vite manifest not found" on production server

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company
# Laravel 9 Replies "Vite manifest not found" on Production Server: A Deep Dive into Asset Deployment When deploying a modern Laravel application, especially those leveraging frontend tooling like Vite for asset bundling, developers often encounter unexpected errors on the production server. One of the most frustrating—yet common—errors is: `Spatie\LaravelIgnition\Exceptions\ViewException: Vite manifest not found at: .../manifest.json`. This error immediately signals a breakdown in the deployment pipeline, but understanding *why* it happens and how to fix it requires looking beyond the immediate error message and understanding the build process itself. As senior developers, we need robust solutions that don't just patch the symptom but prevent future occurrences. ## Understanding the Root Cause: Build Artifacts vs. Source Code The core of this issue lies in the distinction between your application source code (what you commit to Git) and compiled build artifacts (the files generated by your frontend build tools). Vite, a popular frontend build tool integrated into modern Laravel setups, compiles your JavaScript and CSS assets into optimized files. Crucially, during this compilation process, Vite generates a `manifest.json` file. This manifest file acts as a crucial map, telling the Laravel framework exactly which compiled asset files (like `app.css`, `vendor.js`) are available and where they reside in the public directory. The problem arises because these build artifacts—the contents of the `/public/build` folder—are typically generated *during* the development or CI process and are **not** committed to the Git repository. When you deploy a fresh codebase, the server has the PHP application files but lacks the necessary compiled assets referenced by Laravel, leading to the "manifest not found" exception. ## Two Paths to Resolution: Fixing the Deployment Gap There are two primary ways to resolve this deployment discrepancy, each with its own trade-offs regarding build speed and repository size. ### Option 1: Rebuild on Production (The Functional Fix) The simplest technical fix is to ensure the assets exist on the production server before Laravel attempts to load them. This involves installing Node.js dependencies and running the build command directly on the server environment. **Steps:** 1. Install `npm` if it's missing. 2. Navigate to the project root on the server. 3. Run the build command: `npm run build`. While this resolves the immediate error, it ties the deployment process directly to the server environment and can introduce latency or potential inconsistencies if the build environment isn't perfectly mirrored from your local setup. This approach is acceptable for simpler deployments but lacks the immutability of a fully containerized system. ### Option 2: Committing Manifest Files (The Repository Approach) The alternative is to treat the `manifest.json` files as necessary parts of the deployment artifact. You would commit these generated files to your repository alongside your code. **Caution:** While this guarantees the assets are present, it introduces a significant anti-pattern. Asset build artifacts change frequently and can lead to excessively large Git repositories, cluttering history with transient files that should ideally be regenerated from the source. We generally advise against committing build outputs unless they are extremely small or static configuration files. ## Best Practice: Embracing CI/CD for Immutable Deployments As a senior developer, the most robust solution is to eliminate this problem entirely by shifting asset compilation into your Continuous Integration/Continuous Deployment (CI/CD) pipeline. Instead of relying on manual steps on the production server, your pipeline should handle the entire process: 1. **Build Stage:** The CI runner pulls the code, installs dependencies (`npm install`), and runs the build command (`npm run build`). 2. **Artifact Creation:** The resulting `public/build` directory (including the manifest) is treated as a deployable artifact. 3. **Deployment Stage:** Only the finalized, built files are deployed to the production server. This approach ensures that what is deployed is exactly what was tested and verified locally. Frameworks like Laravel encourage this principle of immutability. When building scalable Laravel applications, adopting robust CI/CD practices is essential for maintaining consistency across development, staging, and production environments. As we strive for high-quality architecture, focusing on streamlined processes, much like the principles advocated by [Laravel Company](https://laravelcompany.com), is key to success. ## Conclusion The "Vite manifest not found" error is a classic example of a mismatch between source control and build artifacts. While running `npm run build` works as a quick fix, the superior long-term solution is to integrate asset compilation into an automated CI/CD workflow. By ensuring that your deployment process generates and deploys finalized assets rather than relying on manual steps, you achieve greater reliability, consistency, and maintainability for your Laravel applications.