Try running npm run build
Does the path exist in the file ?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Trying to deploy laravel to my project on shared hosting
And I am getting this Unable to locate file in Vite manifest: resources/css/app.css.
I have changed the env app_url to the current project and I have clear cache and config and I am still getting same error
Try running npm run build
Does the path exist in the file ?
@Sinnbeck yes build file exist in the public folder, I don't think I can run npm run build on shared hosting
@ene does resources/css/app.css inside the manifest file?
@Sinnbeck if I get you, the resources folder has CSS folder and js , why the build folder contains the assets/CSS and js
@ene open /public/build/manifest.json and see if it contains resources/css/app.css
@Sinnbeck yes
{
"resources/js/app.js": {
"file": "assets/app.e8b13026.js",
"src": "resources/js/app.js",
"isEntry": true
},
"resources/css\app.css": {
"file": "assets/app.d9942b16.css",
"src": "resources/css\app.css"
}
}
@ene that slash is the wrong way around. Update to vite 3.x locally, and rebuild. Then upload again
@Sinnbeck ok will try that
@Sinnbeck how do you upgrade vite?
@ene show your package.json please
@Sinnbeck here
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.0",
"alpinejs": "^3.0.6",
"autoprefixer": "^10.4.7",
"axios": "^0.27",
"laravel-vite-plugin": "^0.5.0",
"lodash": "^4.17.19",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.0",
"vite": "^3.0.0"
},
"dependencies": {
"and": "^0.0.3",
"build": "^0.1.4",
"daisyui": "^2.20.0",
"npm": "^8.15.0",
"run": "^1.4.0"
}
}
@ene ok it's already 3. Try npm update and then npm run build. Did it fix the manifest file?
@Sinnbeck let me try that now
@Sinnbeck Thank you sir. I just joined Forge and was pulling my hair out trying to get my site to work. Just those two commands and deployed and it works fine.
This was my error:
production.ERROR: Unable to locate file in Vite manifest:
{
"resources/js/app.js": {
"file": "assets/app.f11fd367.js",
"src": "resources/js/app.js",
"isEntry": true
},
"resources/css/app.css": {
"file": "assets/app.a8d175d0.css",
"src": "resources/css/app.css",
"isEntry": true
}
}
@ene perfect. Upload it to production again and it should now work
@Sinnbeck that's worked perfectly, but the issue now is that the css and js are not working
The project isn't getting the styles
@ene what error? 404 on some assets or? Did you remember to upload the full build directory and not just the manifest?
@Sinnbeck no 404 , the project is displaying without no styles , and when i move the build folder out of the public folder i got Unable to locate file in Vite manifest: resources/css/app.css.
@ene yeah don't move it. But did you upload the whole build folder? Can you share the url to the site?
@Sinnbeck yes I did move the whole build file Here is my site https://nairamarts.com
@ene Check if this file exists locally? It is what is referenced in your manifest.json file
https://nairamarts.com/build/assets/app.a8d175d0.css
The path is /public/build/assets/app.a8d175d0.css
@Sinnbeck yes the file exist
I checked my public file and the build file has the assets files and the CSS and js are available
@ene Well it doesnt exist on production? check the link. 404
Ok it seems you have some issues with your htaccess or similar. You need to add /public/ to the urls for them to work. https://nairamarts.com/public/build/assets/app.a8d175d0.css
FIx that and it should work
@Sinnbeck or is the issue coming from the index.php
@ene .htacces or server set up.
this is my htacess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
@ene Ok. As I have no clue about your set up (directory structure), it will be hard for me to give any suggestions
and index
/
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/./vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/./bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle(
$request = Request::capture()
)->send();
@sinnbeck Lets me explain how I moved the file
After uploading the project zip file , I unzip the project and move them to the `public_html`
Then I went to public folder and move the index.php and htacesss into the main files where the files are
Did you change your index file after upload to get it working?
@Sinnbeck yes I did
Before
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
Now
require __DIR__.'/./vendor/autoload.php';
$app = require_once __DIR__.'/./bootstrap/app.php';
RewriteEngine On
#Rewrite everything to subfolder
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/public
Rewriterule ^(.*)$ public/ [L]
I got 403 Forbidden Access to this resource on the server is denied!
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
#Rewrite everything to subfolder
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/public
Rewriterule ^(.*)$ public/ [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
@Sinnbeck please help
@ene sorry but I haven't used shared hosting for years so I don't know the correct htaccess config. Also this problem was originally about why your manifest file wasn't working (which is solved), and now it's "how to set up laravel on shared hosting"
Maybe someone who knows shared hosting will accidentally visit the thread. Or you can make a new thread on that specific problem
I hope it will help you. If you use the last version of Laraval you don't need to create index.php in root and no need to change public/index.php. Just create in the root folder .htaccess
RewriteEngine On
# Internally rewrite all requests to WordPress subdirectory
RewriteRule ^ public%{REQUEST_URI} [L]
then create .htaccess in /public folder
RewriteEngine On
# Redirect any direct requests for "/public/<anything>" back to root
# NB: WP itself *must* already be correctly configured to omit "/public" from the URL
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule (.*) / [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
It helped me to fix all problems related to Vite.
Please or to participate in this conversation.