Unable to locate a class or view for component Laravel Origin: Application & API Last updated 4 Nov 2026

Laravel: InvalidArgumentException: Unable to locate a class or view for component [alert].

A <x-alert /> Blade tag has no matching class or anonymous component view.

Exact message you may see Unable to locate a class or view for component [alert]InvalidArgumentException: Unable to locate a class or view for componentUnable to locate a class or view for component [x-forms.input]Blade component not found Laravel<x-alert> component not found
Seen on: Laravel PHP

Meaning

Anonymous components live in resources/views/components/alert.blade.php; class components in app/View/Components/Alert.php with a view. Sub-folders use dots (<x-forms.input />). Check names, case, and for packages that the service provider registers components.

Common causes

  • Missing resources/views/components/alert.blade.php
  • Wrong sub-folder/dot notation
  • Case mismatch on Linux
  • Package component not registered/published
  • Cached views stale

⚡ Quick fix

  1. Create resources/views/components/alert.blade.php or the class
  2. Use dot notation for folders
  3. php artisan view:clear

Detailed fix by platform

Laravel

  1. php artisan make:component Alert (class + view) or php artisan make:component Alert --view (anonymous)

How to diagnose

  1. File — Component view exists?
  2. Name — Dots for folders?
  3. Package — Published?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

403 This action is unauthorized — Laravel: Illuminate\Auth\Access\AuthorizationException: This action is unauthorized. (Laravel)403 This action is un…Attempt to read property "x" on null — Laravel/PHP 8: ErrorException: Attempt to read property "name" on null (Laravel)Attempt to read prope…Command "x" is not defined — Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these? (Laravel)Command "x" is not de…Composer: Allowed memory size exhausted — Composer: PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer (Laravel)Composer: Allowed mem…InvalidArgumentException: View [x] not found — Laravel: InvalidArgumentException: View [posts.index] not found. (Laravel)InvalidArgumentExcept…Laravel: Allowed memory size exhausted (request) — Laravel/PHP: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in vendor/laravel/framework (Laravel)Laravel: Allowed memo…Livewire: Unable to find component — Laravel Livewire: Livewire\Exceptions\ComponentNotFoundException: Unable to find component: [admin.users] (Laravel)Livewire: Unable to f…TypeError: Argument #1 must be of type X, Y given — Laravel/PHP: TypeError: App\Services\Mailer::send(): Argument #1 ($user) must be of type App\Models\User, null given (Laravel)TypeError: Argument #…Unable to…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.