Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ene's avatar
Level 2

Unable to locate file in Vite manifest: resources/css/app.css.

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

0 likes
41 replies
Sinnbeck's avatar

Try running npm run build

Does the path exist in the file ?

ene's avatar
Level 2

@Sinnbeck yes build file exist in the public folder, I don't think I can run npm run build on shared hosting

ene's avatar
Level 2

@Sinnbeck if I get you, the resources folder has CSS folder and js , why the build folder contains the assets/CSS and js

Sinnbeck's avatar

@ene open /public/build/manifest.json and see if it contains resources/css/app.css

ene's avatar
Level 2

@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"
  }
}
Sinnbeck's avatar

@ene that slash is the wrong way around. Update to vite 3.x locally, and rebuild. Then upload again

ene's avatar
Level 2

@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"
    }
}

Sinnbeck's avatar

@ene ok it's already 3. Try npm update and then npm run build. Did it fix the manifest file?

1 like
waywardson's avatar

@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:

ene's avatar
Level 2

@sinnbeck

{
  "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
  }
}
Sinnbeck's avatar

@ene perfect. Upload it to production again and it should now work

ene's avatar
Level 2

@Sinnbeck that's worked perfectly, but the issue now is that the css and js are not working

ene's avatar
Level 2

The project isn't getting the styles

Sinnbeck's avatar

@ene what error? 404 on some assets or? Did you remember to upload the full build directory and not just the manifest?

ene's avatar
Level 2

@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.

Sinnbeck's avatar

@ene yeah don't move it. But did you upload the whole build folder? Can you share the url to the site?

ene's avatar
Level 2

I checked my public file and the build file has the assets files and the CSS and js are available

Sinnbeck's avatar

@ene Well it doesnt exist on production? check the link. 404

ene's avatar
Level 2

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>
Sinnbeck's avatar

@ene Ok. As I have no clue about your set up (directory structure), it will be hard for me to give any suggestions

ene's avatar
Level 2

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();
ene's avatar
Level 2

@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






Sinnbeck's avatar

Did you change your index file after upload to get it working?

ene's avatar
Level 2

@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';
Tray2's avatar

@Sinnbeck

RewriteEngine On 

#Rewrite everything to subfolder 
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/public
Rewriterule ^(.*)$ public/ [L]
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@Tray2 thanks!

@ene dont edit the php files. Here is some htaccess that should help fix both

ene's avatar
Level 2

@Sinnbeck

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's avatar

@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

devisv505's avatar

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.