Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Rretzko's avatar
Level 15

"Livewire\Exceptions\ComponentNotFoundException in Production

Hi - I've written an application on Laravel 10.21/Livewire 3.01. It works exactly as expected on my local machine (Windows) but hits the Livewire\Exceptions\ComponentNotFoundException in production (Vapor->AWS Lambda). I tried the "php artisan livewire:discover" cli command suggested in a related post, but that resulted in an error (Command "livewire:discover" is not defined.) Perhaps this has been removed in v3. My livewire directory is:

app
   livewire
      schools
          SchoolComponent.php

The component is as follows:

<?php

namespace App\Livewire\schools;

use App\Models\students\School;
use App\Models\User;
use Livewire\Attributes\Rule;
use Livewire\Component;

class SchoolComponent extends Component
{
...
}

The view calling this is:

<livewire:schools.school-component />

Lastly, when I create a component, I use the following:

php artisan make:livewire \schools\NewComponent

Your assistance is appreciated!

0 likes
3 replies
LaryAI's avatar
Level 58

The error message "Livewire\Exceptions\ComponentNotFoundException" typically occurs when Livewire is unable to find the specified component. Here are a few steps you can take to troubleshoot and resolve the issue:

  1. Make sure the Livewire package is installed correctly by running composer require livewire/livewire in your project directory.

  2. Check if the Livewire service provider is registered in your config/app.php file. Look for the following line in the providers array:

    Livewire\LivewireServiceProvider::class,
    

    If it's not present, add it and save the file.

  3. Ensure that the Livewire component file (SchoolComponent.php in this case) is located in the correct directory (app/Livewire/school).

  4. Verify that the Livewire component class is correctly defined and extends the Livewire\Component class. Here's an example of how it should look:

    namespace App\Livewire\School;
    
    use Livewire\Component;
    
    class SchoolComponent extends Component
    {
        // Component logic and properties
    }
    
  5. Double-check the Livewire component tag in your view file. It should match the namespace and class name of the component. In this case, it should be:

    <livewire:school.school-component />
    
  6. Clear the Laravel application cache by running php artisan cache:clear and php artisan config:clear in your project directory.

  7. If you're using a caching mechanism like Redis or Memcached, clear the cache for your application.

  8. If you're using a deployment tool like Vapor, make sure that the Livewire package is included in your deployment configuration.

If the issue persists, please provide more details about your setup and any error messages you're encountering, so we can assist you further.

Rretzko's avatar
Level 15

Hi - Still broken, but here's an update: I commented-out the school.* files and implemented the Counter example from the Livewire documentation, with the same results.

//calling view
<livewire:counter />

//component
<?php

namespace App\Livewire;

use Livewire\Component;

class Counter extends Component
{
    public $count = 1;

    public function increment()
    {
        $this->count++;
    }

    public function decrement()
    {
        $this->count--;
    }
    public function render()
    {
        return view('livewire.counter');
    }
}

//view
<div>
    <h1>{{ $count }}</h1>

    <button wire:click="increment">+</button>

    <button wire:click="decrement">-</button>
</div>

Thanks for any thoughts/assistance you can offer!

tinkodev's avatar

@Rretzko Hi man, I was troubled with this, for 8 hours, for me this script worked, I hope could help for you also: php artisan livewire:layout

Please or to participate in this conversation.