I Working on project that working with laravel 9
and Vite
with laravel-vite
,
In Dev environment all thing working fine, but in production cPanel server I has this issue
Vite manifest not found at: /home/???????/cart_shop/public/build/manifest.json
# With
Missing Vite Manifest File
Did you forget to run `npm install && npm run dev`?
I tried to solve the problem but nothing work, I need to change the public folder and the sup folder build file place from vite.config.js but I don’t find the way to do that.
Note that: the file sequence is changed in cPanel shared server from
- home
- public_html
- cart_shop
- Root
- public
- etc
To
- home
- public_html
- public files and folders // I changed the index URLs too.
- cart_shop
- Root
- etc
my vite.config.js
config is like:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.js',
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
});
11
Answers
The issue solved,
first: I try adding
publicDirectory
configration intolaravel-vite-plugin
setting invite.config.js
that solve the build issue but manifest still not founded.Finally: I move all files and folders except
build
frompublic
tobublic_html
thennpm run build
and it's working fine.just go to your public folder and there is a hot file in that file there is a link like this http://127.0.0.1:3000 change this link to your domain link i mean your website link
I had the same issue only because of node version. I upgraded to the latest version and it’s working properly.
For Ubuntu use n module from npm in order to upgrade node:
To upgrade to latest version (and not current stable) version, you can use:
You may need also to Fix PATH:
To undo:
You may need to restart your terminal to see the updated node version.
Found in Ask Ubuntu
If the
manifest.json
file does exist but you’re still seeing this error, make sure the permissions are good:I had a similar problem and I was able to resolve it by installing the
node
current stable version. In my case, the node version was14+
, and when I upgraded to the current version which isv16.17.0
, everything works just fine. The comments here were helpful.Visit the official
node
website to download and install the latest node version.Type this it’s works for me
In my case, I have solved this problem by doing some things.
First of all, I have made sure required npm packages are installed by running this command
After that, I have run
To build assets and create the manifest file.
Update Node.js to its latest version: https://nodejs.org/en/
Then run
npm run dev
.Remove
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
from the<head>
of the fileapp.blade.php
on Laravel 9. And now it works like a charm.I solved this problem like this:
npm run build
public
files insidepublic_html
. Create apublic
file in the root of the domain and put thebuild
folder inside it And it was done.What fixed it for me was to use a recent version of Node.
You can use nvm for that: