kbzone's avatar

laravel in shared hosting: vite manifest.json not found

i know that deploy a laravel project in a shared hosting is not recommended, but its a client issue. because of this i can't run console commands: pure pain, i know.

by recomendations, my folder structure is this:

...

[laravel-project] <-- all laravel files, except "/public" folder

[public_html] <-- all /public folder content

...

as you can see, the folder structure in the server is different as we have working in local; because in local environment the "public" is INSIDE the laravel-project.

so, when i try to view my project in browser, i see this error:

Vite manifest not found at: /home/server/laravel-project/public/build/manifest.json

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

the manifest.json exists in server, but is in: "/home/server/laravel-project/build/manifest.json"

question: my folder structure is wrong? should i maintain the structure as local?

many thanks.

0 likes
7 replies
Sinnbeck's avatar

You need to run npm run build and upload the build folder in public as well

kbzone's avatar

@Sinnbeck i did it, it converts correctly, the thing is that the @vite directive try to search the manifest.json file in the incorrect path.

the manifest.json exists in server, but is in: "/home/server/laravel-project/build/manifest.json"

but in the error says that @vite is searching in other path: "/home/server/laravel-project/public/build/manifest.json"

you consider that my folder structure is right?

thinkverse's avatar

Your folder structure is wrong. The contents of the public folder should never be moved to the root of the project. Instead, configure your server to direct the traffic to public/index.php. and that's for safety reasons.

Looking at Laravel's Vite plugin PluginConfig you can change the public directory. So if you want to change that directory, then change the publicDirectory or the buildDirectory config accordingly. But you might also need to change how you call @vite in your blade views. I've never changed those directories myself so cannot comment on how.

1 like
nei's avatar

I had exactly the same problem on hostinger. @kbzone the quick solution for me is to keep a copy of the public folder containing the build folder on the path the app was looking for /home/server/laravel-project/public/build/manifest.json

Did you find how to proper setup the path via configs?

3 likes
mrrighteous's avatar

@nei I conquer this solution worked for me as well just creating a copy of the folder where vite is looking ... Thanks

Please or to participate in this conversation.