Show full content
Laravel Mix “Unable to Locate Mix File” Error: Causes and Fixes
If you’re working with Laravel and using Laravel Mix to manage your CSS and JavaScript assets, you may have come across an error like this:
Spatie\LaravelIgnition\Exceptions\ViewException Message: Unable to locate Mix file: /assets/vendor/css/rtl/core.css
Or in some cases:
Illuminate\Foundation\MixFileNotFoundException Unable to locate Mix file: /assets/vendor/fonts/boxicons.css
This error can be frustrating, especially when your project works perfectly on one machine but fails on another. Let’s break down what’s happening and how to solve it.
What Causes This Error?
Laravel Mix is a wrapper around Webpack, designed to compile your resources/ assets (CSS, JS, images) into the public/ directory. The mix() helper in Blade templates references these compiled assets using a special file: mix-manifest.json.
This error occurs when Laravel cannot find the compiled asset. Common reasons include:
- Assets are not compiled yet
If you’ve just cloned a project, thepublic/assetsfolder might be empty. Laravel is looking for files that do not exist yet. mix-manifest.jsonis missing or outdated
This file maps original asset paths to compiled paths. If it’s missing, Laravel Mix won’t know where to find your assets.- Incorrect paths in Blade templates
If your code is like:<link rel="stylesheet" href="{{ asset(mix('assets/vendor/css/rtl/core.css')) }}" />but the RTL folder or the file doesn’t exist, Mix will throw an exception. - Wrong configuration
Some themes use variables like$configData['rtlSupport']to toggle right-to-left CSS. If it’s set incorrectly, Laravel will try to load files that don’t exist.
How to Fix It
Here’s a step-by-step solution:
1. Install NPM dependenciesMake sure you have Node.js installed, then run:
npm install2. Compile your assets
- Development mode (fast, unminified):
npm run dev
- Production mode (optimized, minified):
npm run build
This will generate your CSS and JS files in the public folder and update mix-manifest.json.
mix-manifest.json
Ensure the manifest contains the file Laravel is looking for:
"/assets/vendor/css/rtl/core.css": "/assets/vendor/css/rtl/core.css"4. Adjust Blade template paths
If you don’t use RTL, you can set:
$configData['rtlSupport'] = '';
so the code doesn’t try to load /rtl/core.css unnecessarily.
Laravel may cache old views and configs. Clear them:
php artisan view:clear php artisan config:clear php artisan cache:clear
Pro Tips
- Always check if the file exists in
public/assets/...after compiling. - If you move your project to another machine or server, you must run
npm installandnpm run devagain. - For production, make sure your server has Node.js and NPM installed, otherwise Laravel Mix cannot build the assets.
Conclusion
The “Unable to locate Mix file” error is not a bug in Laravel, but a result of missing compiled assets or misconfigured paths. Once you:
- Install dependencies.
- Compile assets,
- Correct Blade paths, and
- Clear caches; your Laravel project should load CSS and JS files without issues.







,Today I will share with you my three pivotal values: learning, community, and service. My journey exemplifies how integrating these principles can lead to meaningful technological innovations.
