php – The Mix manifest does not exist when it does exist-ThrowExceptions

Exception or error:

For my admin panel I extract all the assets including the manifest-json.js to mix.setPublicPath(path.normalize('public/backend/')).

All the files get correctly added to the backend folder, and the manifest-json.js file looks as follows:

{
    // all correct here
    "/js/vendor.js": "/js/vendor.js",
    "/js/app.js": "/js/app.js",
    "/css/app.css": "/css/app.css",
    "/js/manifest.js": "/js/manifest.js"
}

the problem is that when using

{{ mix('backend/css/app.css') }}

in my blade-files, it looks in public/manifest-json.js instead of looking for it in backend/manifest-json.js.

How can I make sure the right manifest-json.js file is used?

How to solve:

i solved my problem running this command

npm install

and then

npm run production

Thank You.

Answer:

I had same exception after deployment laravel project to server. It was working perfectly fine on localhost but after lot of research I found a solution. If you encounter this exception on server then you have to bind your public path to public_html

Just go to under the app/Providers, you will find your AppServiceProvider file and inside boot() method make the binding as below.

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

Answer:

The problem I faced was that the mix()-helper function by default looks for the manifest-json file in /public/manifest-json.js so if you store that file on any other directory level then it will throw that error.

Let’s say the manifest-json file is stored in public/app/manifest-json.js, then for a file located in public/app/css/app.css you would use:

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

The mix()-helper function allows for a second argument, the directory of the manifest file. Just specify it there and it will use the correct manifest file.

Answer:

In shared hosts and laravel 5.6 tested:
after doing standard levels such as explained here;
two levels needed:
in app/Providers/AppServiceProvider.php:

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

and in public_html file make .htaccess file with content:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
  ErrorDocument 404 /index.php
</IfModule>

source: here
this file most change for some situations.

that’s all and solved my problem

Answer:

i have same problem as questioner: manifest does not exist for solving it what i have done is ran 2 commands as following:

npm install

and then

npm run dev

and the error is solved now. yippi.

Answer:

I had the same issue with a Laravel package, its assets were not published:

This solved the issue for me:

php artisan vendor:publish --tag=telescope-assets --force

Sources:
https://github.com/laravel/telescope/issues/136
https://github.com/laravel/telescope/issues/250

Answer:

I found new solution

The problem is mix manifest right?
So just redirect to the mix manifest feature. for example, you have:

{{ style(mix('css/backend.css')) }}

just change your code into

{{ style('css/backend.css') }}

it works for me

Answer:

I had the issue on a shared host, where I was not able to run npm commands. Then I used the simplest way. In the /vendor/laravel/…/Foundation/Mix.php replace

i$manifests[$manifestPath] = json_decode(file_get_contents($manifestPath), true);   

to

$manifests[$manifestPath] = json_decode(file_get_contents('https://your-domain.com/mix-manifest.json'), true);

Not recommended, but it works. You can use it as your last try.

Leave a Reply

Your email address will not be published. Required fields are marked *