I am trying to run a laravel app in my local system. I have followed the https://gist.github.com/hootlex/da59b91c628a6688ceb1 link. I run the command php artisan serve command, and when I browse it, then produces the error
PHP Fatal error: Uncaught Exception: Unable to locate Mix file: /css/vendor.css. Please check your webpack.mix.js output paths and try again. in /var/www/html/laravel-app/app/helpers.php:439
In the specified line of helpers.php, it has
if (! isset($manifest[$path])) {
throw new Exception(
"Unable to locate Mix file: {$path}. Please check your ".
'webpack.mix.js output paths and try again.'
);
}
public/mix-manifest.json
{
"/mix.js": "/mix.js"
}
I couldn't sort it out. Please help. Thanks
The blade file you're loading obviously has mix('/css/vendor.css')
call. You either comment out this line(s) or install npm then build your assets.
Your manifest file doesn't have /css/vendor.css
but if you check your blade files (views
) you'll see you are calling mix('/css/vendor.css')
. So if you find and comment out this line(s) your problem will be solved.
Ideally, mix()
is used for loading assets that were built by webpack. It will then take care of the versioning string for you. How mix can be used is detailed in the documentation. I will refrain myself from discussing that here.
You've built your assets by running npm run dev
or similar commands. And then the manifest file doesn't contain those assets mapping. And your public
directory doesn't have those assets as well. Then it's safe to assume that you can remove those mix
calls from your blade (views
) files.
If you have the assets built in your public
directory then you can load those assets by assets
function.
Lastly, you should know your assets first, before loading them to your site. I get the notion that you don't have any clue where those assets came from, so you shouldn't load them in the first place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With