bahdcoder / Laravel-5.3-and-Vue-js-2.0-social-network

Social network built with Laravel 5.3 and Vue js 2.0
134 stars 91 forks source link

Pusher is not defined. #5

Open georgejkollias opened 7 years ago

georgejkollias commented 7 years ago

I am getting the following error when i try and use the broadcasting with the social network.

I have created the pusher app i am referencing this in the app and its stopped working

this is the line createClass(PusherConnector, [{ key: 'connect', value: function connect() { this.pusher = new Pusher(this.options.key, this.options); } }

this.pusher is where the app i breaking:

echo.js?8fc2:546 Uncaught ReferenceError: Pusher is not defined at PusherConnector.connect (eval at (app.js:122), :546:31) at PusherConnector.Connector (eval at (app.js:122), :192:14) at new PusherConnector (eval at (app.js:122), :537:135) at new Echo (eval at (app.js:122), :689:30) at eval (eval at (app.js:84), :46:15) at Object. (app.js:84) at webpack_require (app.js:20) at eval (eval at (app.js:177), :7:1) at Object. (app.js:177) at webpack_require (app.js:20)

i am using laravel 5.4 everything was fine to this point.

If you are able to help much appreciated.

rtd62 commented 7 years ago

@georgejkollias First make sure you also install the pusher-js package after laravel-echo So, npm install --save pusher-js

Afterwards, you have to go to bootstrap.js and insert import Pusher from 'pusher-js' right below require('noty');

Cheers! 🍻

rtd62 commented 7 years ago

@georgejkollias Also, when in doubt, clear cache and run php artisan optimize and uninstall any deps you no longer use.