Pusher Error - Uncaught Referenceerror: Pusher is not defined

Asked

Viewed 241 times

0

Good morning.

I followed this tutorial to the letter: https://pusher.com/tutorials/chat-laravel

But I get the following error in the browser console:

Uncaught ReferenceError: Pusher is not defined
at PusherConnector.connect (VM562 app.js:36739)
at PusherConnector.Connector (VM562 app.js:36305)
at new PusherConnector (VM562 app.js:36730)
at new Echo (VM562 app.js:36960)
at Object.VERSION (VM562 app.js:14124)
at __webpack_require__ (VM562 app.js:20)
at Object.defineProperty.value (VM562 app.js:14005)
at __webpack_require__ (VM562 app.js:20)
at Object.<anonymous> (VM562 app.js:13990)
at __webpack_require__ (VM562 app.js:20)

I researched and said to import this line (import Pusher from "Pusher-js") in bootstrap.js, but the error persists.

Can someone help me?

I’m using Laravel 5.6.37

1 answer

0


Well, I had a similar problem and I solved it this way: I did the installation of Pusher through this tutorial: https://github.com/pusher/pusher-http-laravel up to the "configuration" part. Then I ran an "npn run watch" on the terminal. Also, in Resources/js/bootstrap.js upgrade to:

import Echo from "laravel-echo";
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'your-pusher-key'
});

After this my messaging application worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.