How to Resolve "Vite manifest not found" Error【Laravel】
Thank you for your continued support.
This article contains advertisements that help fund our operations.
This article explains how to resolve the 'Vite manifest not found' error encountered when deploying a project in Laravel.
Full Error Message
Vite manifest not found at: /var/www/html/laravel-docker/src/public/build/manifest.json
Solution
You can resolve this by building with Vite.
Development Environment
npm run dev
Production Environment
npm run build
Explanation
By running these commands, the development environment will stop referencing manifest.json
, and in the production environment, manifest.json
will be generated, resolving this error.
In the project code, you might see something like this in files such as resources/views/app.blade.php
:
@vite(['resources/js/app.js', "resources/js/Pages/{$page['component']}.vue"])
This part's output changes depending on whether you run npm run dev
or npm run build
.
That’s the solution for this issue.
The following is for those who need more detailed instructions.
If Node.js is Not Installed
Checking Node.js Version
node -v
Checking npm Version
npm -v
How to Install Node
When Using Docker for Environment Setup
In the Laravel project container's Dockerfile, add Node and rebuild.
FROM php:8.3-fpm
~~omitted~~
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y nodejs
docker compose down
docker compose up -d --build
→ How to Set Up Laravel 11 Development Environment Using Docker【with Video】
In Production Environment
For example, with Amazon Linux 2023, installing via NVM can be convenient.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install --lts
→ How to Deploy Laravel Project to AWS EC2【Amazon Linux 2023 Edition】
Conclusion
I’ve included a brief example of how to install Node.js. The best approach will vary depending on your environment, but I hope this helps as a reference.