Laravel-mix: BrowserSync

Created on 27 Feb 2017  路  5Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: ^0.6.0
  • Node Version (node -v): v6.5.0
  • NPM Version (npm -v): 4.0.2
  • OS: Windows 10

Description:

I installed a fresh copy of Laravel 5.4.9. I then followed the instructions on the Laravel docs for using browsersync. It doesnt work though. I get the error.

mix.browserSync();
    ^

TypeError: mix.browserSync is not a function

So I read to install (which is not specified in the docs):

  1. browser-sync
  2. browser-sync-webpack-plugin

and do some other config to get it working by adding the plugin to webpack. Still can't get it to work. I thought, by looking at the docs that browsersync support was out of the box?

Steps To Reproduce:

  1. Install fresh copy of Laravel
  2. Follow the laravel docs: https://laravel.com/docs/5.4/mix#browsersync-reloading
  3. npm run watch

Most helpful comment

You have version 0.6.0 of Laravel Mix, and we're currently on 0.8.8. Update to the latest version.

All 5 comments

You have version 0.6.0 of Laravel Mix, and we're currently on 0.8.8. Update to the latest version.

Why did that version get pulled in with the latest version of laravel? Just so I know for future how to get around situation where the package.json has older versions in it :)

I don't know how you installed Laravel. You can see on GitHub that Laravel references the latest version of Mix.

https://github.com/laravel/laravel/blob/master/package.json#L14

Yeah I noticed that as well. I pulled it in by running this command composer create-project laravel/laravel blog which gave me the latest version of laravel. When I tried the one listed on the laravel site composer create-project laravel/laravel blog --prefer-dist it gave me an older 5.4 version.

I installed laravel via composer through phpstorm new project wizard. and webpack version was old for me too.updating solved the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RomainGoncalves picture RomainGoncalves  路  3Comments

nezaboravi picture nezaboravi  路  3Comments

Bomavi picture Bomavi  路  3Comments

Micaso picture Micaso  路  3Comments

sdebacker picture sdebacker  路  3Comments