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

geetpurwar's avatar

Laravel Echo not working with Livewire

Hi,

I created a livewire component and setup a listener to listen to Pusher notifications and repond. I don't know what wrong I am doing, but component doesn;'t seems to be responding.

Here's the component. Event is firing. I am also getting a warning in console 'Laravel Echo not found'

Livewire Component:

<?php

namespace App\Http\Livewire;

use Livewire\Component;
use App\Events\OrderShipped;

class Welcome extends Component
{
    protected $listeners = ['echo:orders,OrderShipped' => 'notifyNewOrder'];

    public function notifyNewOrder()
    {
        logger('Order Shipped');
    }

    public function render()
    {
        return <<<'blade'
    <div>
        Order Status Update
    </div>
blade;
    }
}

Page:

<head>
    @livewireStyles
    <script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
    <meta name="csrf-token" content="{{ csrf_token() }}">
</head>

<body>
    @livewire('welcome')

    @livewireScripts
    <script src="{{ mix('js/app.js') }}" ></script>
</body>

App.js

import Echo from 'laravel-echo'
import Pusher from 'pusher-js'

window.Pusher = Pusher

window.Echo = new Echo({
  broadcaster: 'pusher',
  key: 'c371c727b9e62d57abe1',
  cluster: 'mt1',
  forceTLS: true,
})

window.Echo.channel('orders').listen('OrderShipped', (e) => {
  console.log(e)
})
0 likes
9 replies
Sinnbeck's avatar

Are you 100% sure that is the exact error? I did a google search for the error and you are the first person in the world to get that specific error message: I also cannot find that error anywhere in livewire or laravel or laravel echo

ItsClassified's avatar

@Sinnbeck I am having this exact error right now: "Laravel Echo cannot be found"

To give some more information I am migrating from mix to vite on Laravel 9, this is when this error started showing.

And before someone calls me fake:

if (typeof Echo === 'undefined') {
                        console.warn('Laravel Echo cannot be found')
                        return
                    }

The code that show the error..

Sinnbeck's avatar

@ItsClassified Luckily he already solved it :) So if the problems is exactly the same just do the same fix

I figured out the issue. It was not broadcasted over Redis for some reason. Changed queue to database and it worked fine.

If that isnt the problem, please make a new thread explaining your problem

Edit: I see you updated it with an example. This is the code that exposes Echo to the browser window :) https://github.com/laravel/laravel/blob/9.x/resources/js/bootstrap.js#L26

Please or to participate in this conversation.