ACDMan's avatar
Level 1

Vite Manifest not found - \public\resources/js/app.js/manifest.json

Hello! I seem to be having a problem with Vite. My website runs with the JS and CSS files I set up when I'm using npm run dev but when I try to launch the website after using npm run build and without using the VIte dev server, an error popups - Vite manifest not found at \public\resources/js/app.js/manifest.json.

I checked the files and manifest.json exists at public/build and all JS/CSS files are in build/assets but the problem seems to be that Laravel is referring to the wrong directory for the manifest. Is there a way to fix this?

0 likes
5 replies
ACDMan's avatar
Level 1

Tested it on a new project. The issue doesn't seem to be project-specific since I'm still getting the issue on the new project.

RemiM's avatar

Check that you have those elements in your package.json:

"scripts": {
    "dev": "vite",
    "build": "vite build"
}
...
"devDependencies": {
  "laravel-vite-plugin": "^1.0.0",
  "vite": "^5.0.0"

Then you can remove and reinstall the npm packages:

rm -rf node_modules
npm install
npm run build

If this resolves your issue, that great. Otherwise, please provide details about your setup, including your vite.config.js, as well as your Node, npm, and Laravel versions.

ACDMan's avatar
Level 1

@RemiM Hello! The package.json elements does exist. Currently, the only difference is that Vite is 6.0 rather than 5.0.0.

"scripts": {
        "build": "vite build",
        "dev": "vite"
    },
    "devDependencies": {
        "autoprefixer": "^10.4.20",
        "axios": "^1.7.4",
        "concurrently": "^9.0.1",
        "laravel-vite-plugin": "^1.0",
        "postcss": "^8.5.1",
        "tailwindcss": "^3.4.17",
        "vite": "^6.0"
    }

I've tried removing and reinstalling node_modules and tried creating an entirely different project but the problem still persists even on other projects.

I tried to check the specific error on the vendor ( throw new ViteManifestNotFoundException("Vite manifest not found at: $path");). I tried to dd it and the $path goes to \public\resources/js/app.js/manifest.json for some reason.

As for the vite.config.js, I have this:


import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js', 'resources/js/registration.js', 'resources/js/succesful_registration.js'],
            refresh: true,
        }),
    ],
});

For the versions, I have the following: Laravel: 11.36.1 Node: 20.11.1 NPM: 10.2.4

ACDMan's avatar
ACDMan
OP
Best Answer
Level 1

@RemiM Hello again! It seems I just missed something on my blade files.

My issue was that I was using

@vite('resources/css/app.css', 'resources/js/app.js')

and not

@vite(['resources/css/app.css', 'resources/js/app.js'])

Just some missing brackets. Apologies and thanks.

vetal33's avatar

you need to specify the path to the manifest file in AppServiceProvider

public function boot(): void { ... Vite::useManifestFilename('.vite/manifest.json'); ...

}

because because manifest.json is now in the .vite folder

Please or to participate in this conversation.