question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File event change but doesn't reload in browser- random

See original GitHub issue

I have an issue with BrowserSync set up via Gulp in both Laravel Valet and VVV Vagrant workflows using WordPress. (Valet and VVV are not run at the same time - I just have noticed the issue in both)

I find that that new sites created work fine with BrowserSync and all watched files when changed update and the browser reloads - however randomly after a while the browser reload stops even though the file event change is recognised in the output. Other Gulp tasks carry on working normally just the BrowserSync stops.

I have macOS Sierra 10.12.6 Gulp 3.9.1 Node 8.11.3 BrowserSync 2.24.6

Once the issues occurs it fails in all browsers and on restart - it also fails if executed as a command in a terminal session - ie

browser-sync start --proxy "mysite.test" --files "*.css"

My gulp file task…

var gulp = require('gulp');
var gutil = require('gulp-util');
var browserSync = require('browser-sync').create();
var sitename = 'mysite'; 

// Fire up browserSync
gulp.task('sync', function() {
    browserSync.init({
        proxy: sitename +'.test',
	xip: true,
	    
	files: ["./*.css","*.php","css/*css","lib/*.php", "includes/*.php", "includes-child/*.php", "includes-child/woocommerce/*.php", "includes-child/woocommerce/*.css"],
	
    });

});

My Task output

> Executing task: node_modules/.bin/gulp sync <

[18:26:01] Using gulpfile ~/Sites/mysite/wp-content/themes/mytheme/gulpfile.js
[18:26:01] Starting 'sync'...
[18:26:01] Finished 'sync' after 69 ms
[Browsersync] Proxying: http://mysite.test
[Browsersync] Access URLs:
 --------------------------------------------
       Local: http://127.0.0.1.xip.io:3000
    External: http://192.168.0.22.xip.io:3000
 --------------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.0.22.xip.io:3001
 --------------------------------------------
[Browsersync] Watching files...
[Browsersync] File event [change] : style.css
[Browsersync] File event [change] : style.css
[Browsersync] File event [change] : style.css
[Browsersync] File event [change] : style.css

Any thoughts?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
uaibocommented, Sep 12, 2019

Here’s the solution that worked for me:

browserSync.init({
  injectChanges: false
});

injectChanges is true by default: https://www.browsersync.io/docs/options#option-injectChanges

1reaction
neilgeecommented, May 15, 2020

Yes @uaibo solution also worked for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript file not updating no matter what I do - Stack Overflow
Try using Fiddler to see if you are downloading the file at all and if the content is correct. · In Safari (Sierra),...
Read more >
Fix Chrome if it crashes or won't open - Google Support
To fix: Open More More and then Settings. At the bottom, click Advanced and then System. Turn off Use hardware acceleration when available....
Read more >
How to Disable Page Auto-reloading on Safari Mac?
Restart is the best solution that you can do right now – and it's as simple as turning off your browser and turning...
Read more >
You may receive a "Your changes could not be saved" error ...
When you save a Microsoft Excel workbook file on a network drive and you do not ... The file is actually saved to...
Read more >
Android reloads web page when selecting file [36967486]
Most likely your device is running low on memory so when you open the file chooser dialog, the browser app is closed. When...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found