Missing mix-manifest file in Laravel 8 shared hosting

Viewed 2978

I have deployed a Laravel web application in a shared hosting environment. When I try to authenticate, it pops out that mix-manifest is missing.

guest.blade.php

<!-- Styles -->
    <link rel="stylesheet" href="{{ mix('css/app.css') }}">

    <!-- Scripts -->
    <script src="{{ mix('js/app.js') }}" defer></script>
</head> -->

My mix-manifest.json file is located in the root folder for the specific domain, e.g., domain folder->mix-manifest.json and CSS/JS folder are in the same folder. I ran npm install and npm dev in my localhost, and here is the content of my mix-manifest.json file.

{
    "/js/app.js": "/js/app.js",
    "/css/app.css": "/css/app.css"
}

I also set the path in providers -> Appservice providers under the boot method.

    $this->app->bind('path.public', function() {

    return realpath(base_path().'/../public_html');
});

Still, no luck. Can anybody tell me how to set it for mix-manifest file identification in a shared hosting environment?

2 Answers

I had same situation, code in AppServiceProvider helped me to solve mix-manifest problem.

 public function boot()
 {        

    $this->app->bind('path.public', function() {
        return realpath(base_path().'/../public_html');
    });

  }

Code in guest.blade.php is same as yours. My mix-manifest looks like this:

{
 "/js/app.js": "/js/app.js?id=fe077e7e698c6354e768",
 "/css/app.css": "/css/app.css?id=f0ec778ac1ff1c272c28",
}

I run npm run production localy and then uploaded all files from public folder to shared hosting public_html folder

Also make sure to include this code to webpack.mix.js

if (mix.inProduction()) {
   mix.version();
}

Rest of the code is located in /home/USER/YOURAPPNAME on shared hosting.

First, check the mix-manifest file in public/mix-manifest.json if no means, run the following commands

npm install laravel-mix@latest

npm run dev

Now you can check it

Related