BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.17k stars 754 forks source link

browser-sync stops working #1088

Open playground opened 8 years ago

playground commented 8 years ago

Issue details

This has been working all along, I was running (browser-sync version 2.10.1, express 4.13.3, node 5.8.0) Not sure when this stopped working. I did recently upgrade to node 6.0.0

Now it's taking a long time(like minutes) for the browser-sync to open up chrome (chrome Version 50.0.2661.94 (64-bit)). When chrome finally opens, nothing gets loaded, it's a blank as if it can't connect to the server. I even tried the latest browser-sync version 2.12.5 but the same behavior.

Steps to reproduce/test case

Please provide necessary steps for reproduction of this issue, or better the reduced test case (without any external dependencies).

Please specify which version of Browsersync, node and npm you're running

{cli command here}

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

{Browsersync init code here}

My config setup in gulp

const DEFAULT_PORT = 8008;
const SECURED_PORT = 8010;

const serverOptions = {
  root: 'src',
  port: 8008,
  host: 'http://localhost:',
  livereload: true
};

function runTdd () {
  return runSequence(tasks.startWebServer, tasks.browserSync);
}

// TDD task
gulp.task(tasks.tdd, () => {
  serverOptions.port = DEFAULT_PORT;
  serverOptions.host = 'http://localhost:';
  runTdd();
});

// TDD https task
gulp.task(tasks.tddHttps, function () {
  serverOptions.port = SECURED_PORT;
  serverOptions.host = 'https://localhost:';
  runTdd();
});

// starts web server
//gulp.task(tasks.startWebServer, () => express.run(['server.js']));
gulp.task(tasks.startWebServer, function () {
  //connect.server(serverOptions);
  return express.run([
    'server.js'
  ]);
});

// Browser sync
gulp.task(tasks.browserSync, () => {
  browserSync.init(null, {
    proxy: serverOptions.host + serverOptions.port + '/ng2-examples',
    files: ["src/**/*.*"],
    browser: "google chrome",
    port: 8009,
  });
});

Like I said this was working until recently. Thanks.

mmikkel commented 8 years ago

Seeing the same behaviour, with a similar setup, since two or three days ago.

jeffreysbrother commented 8 years ago

I have a similar issue. This was working for me just fine last week. Just out of curiosity, have you guys just recently started using variables/constants for port numbers? The only significant change I made to my gulpfile was the addition of variables for this specific purpose.

This doesn't seem to be a decent explanation, however, because I'm able to connect other devices to the external IP when using my Mac, but not while using my PC (Windows 10).

adamreisnz commented 8 years ago

Same problem. I'm using the exact same setup and configuration as before, but it seems to have stopped working after I updated to Node 6.1.0.

Client is throwing the following:

browser-sync-client.2.12.5.js:1 Uncaught SyntaxError: Unexpected token <

Edit: seemed to have fixed itself after installing bs 2.12.8.

stephenway commented 8 years ago

Same issue, hasn't fixed itself in BrowserSync v2.12.8.

adamreisnz commented 8 years ago

I think it's some sort of a caching issue perhaps. On my laptop, it now works intermittently. When a new tab opens with the project, I can see the browser is still trying to load 2.12.5, but then after I do a manual refresh with the console open it suddenly works for the rest of the session.

On my other computer, where I updated BrowserSync prior to using it I did not have this issue and it seems to be working fine with 2.12.8.

stephenway commented 8 years ago

I think the key word is intermittently, I'll observe 1-2 loads, but not consistently or completely.

Ks89 commented 8 years ago

exactly the same problem

falvhb commented 8 years ago

Same problem here.

atthakorn commented 8 years ago

I have the issue too.

I run against node v5.12.0, browser-sync v2.13.0 in vagrant box on windows with proxy setting. IE, Firefox is normally connected to BrowserSync except Chrome

tayfunerbilen commented 5 years ago

After 2 years ago, same issue.. it is working for a while and then stopping. is there any solution?

mifantwan commented 5 years ago

i have same issue on my sierra notebook, i write many gulp configuration but still not work

waltercruz commented 5 years ago

@tayfunerbilen and @mifantwan it seems that the issue is node 11

https://github.com/BrowserSync/browser-sync/issues/1626

mifantwan commented 5 years ago

@waltercruz i'm using node 10.7.0 ...sometimes browser sync work for many reload, but sometimes it stop work at 2 - 3 times reload. i'll try downgrade node version, tq

tayfunerbilen commented 5 years ago

ok, I downgraded my nodejs version from 11 to 10.13, and it's working now.

viktor-ulyankin commented 4 years ago

Exact same problem with v12.13.1 .