Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Laravel mix() throws Unable to locate Mix file

ErrorUnable to locate Mix file: /css/app.css.

Short answer

This error means mix-manifest.json exists but has no entry for the path you passed to mix(). Open the manifest and compare. Fix the path in the view, rebuild so the manifest lists the file, or tell mix() which folder holds the manifest. With app.debug off, Laravel only logs it.

  • Applies to Laravel 10, Laravel Mix 6, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the manifest and see which keys it contains. The path in the error must appear as a key.

    cat public/mix-manifest.json
  2. 2Match what you see, then jump to its fix

    1. 1The manifest has a key like /js/app.js but the view asks for another nameThe path in the view differs from the key in the manifestFix
    2. 2The file you need is not in the manifest at allThe manifest is out of date: the asset was never compiledFix
    3. 3The assets are built into public/<folder> and mix() cannot find themThe manifest lives in a sub-folderFix
    4. 4Production works, local environment throwsThe page shows the error only in developmentFix

What does the error look like?

  • Unable to locate Mix file: /css/app.css.

Cause 1 of 4

The path in the view differs from the key in the manifest

1Check

mix() puts a leading slash on the path you give it and looks that exact string up in the manifest. A typo, a different folder or a different file name finds nothing.

grep -rn "mix(" resources/views

2Fix

Use the path exactly as it appears in the manifest, minus the leading slash.

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

3Verify

Reload the page. The tags should render with a ?id= version.

curl -s http://localhost:8000 | grep "app\."

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 4

The manifest is out of date: the asset was never compiled

1Check

Compiling writes the manifest. A new entry in webpack.mix.js, or a deploy that copied code without a build, leaves it without that file.

grep -n "mix\." webpack.mix.js
ls -l public/mix-manifest.json

2Fix

Make sure webpack.mix.js declares the output, then compile again.

// webpack.mix.js
mix.js('resources/js/app.js', 'public/js')
   .postCss('resources/css/app.css', 'public/css');

# then, in the shell
npm install
npx mix

3Verify

The new file should now appear in the manifest.

cat public/mix-manifest.json

Confirmed by laravel-mix.com

Did this fix it?

Cause 3 of 4

The manifest lives in a sub-folder

1Check

mix() reads public/mix-manifest.json unless you pass a second argument. The framework source builds the manifest location from that argument.

find public -name mix-manifest.json

2Fix

Pass the folder that holds the manifest as the second argument.

{{ mix('css/app.css', 'build') }}

3Verify

The tag should render with the versioned URL.

curl -s http://localhost:8000 | grep "build/"

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 4 of 4

The page shows the error only in development

1Check

The framework source throws this exception when app.debug is true. When app.debug is false it reports the exception and returns the plain unversioned path, so the problem can hide in production logs.

grep -n "APP_DEBUG" .env; grep -n "Unable to locate Mix file" storage/logs/laravel.log

2Fix

Fix the missing manifest entry as in the causes above. Do not rely on debug mode being off.

php artisan config:clear

3Verify

No new entry appears in the log after loading the page.

tail -n 20 storage/logs/laravel.log

Confirmed by raw.githubusercontent.com

Did this fix it?

How do I stop it coming back?

  • Build assets in the deploy pipeline before the release goes live.
  • Keep the mix() paths in views in step with webpack.mix.js outputs.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.