0

Problem - When I run gulp, this message appears:

[Browsersync] Couldn't open a browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false)

gulpfile.js code:

gulp.task('serve', function() {
  browserSync.init({
    open: 'external',
    proxy: 'site1.net', // baseDir: "./"
    watchTask: true,
    port: 8080,
    browser: "chrome"
  });
});

I have to manually input the URLs into the browser & it worked with my current connections, but the message is still there. So how do I solve this issue? Any help would be highly appreciated, thanks

Screenshots:

http://www.screencast.com/t/rZDYsPLvM1uv

http://www.screencast.com/t/6MMLk5gA

http://www.screencast.com/t/9EoNLhAlK

(note: sorry can't make hyperlink syntax work after many attempts, which is weird.)

History:

I had no issues with my Browser sync before & my gulp runs automatically - not until now. I think I had Windows 10 64bit update today and this issue came out. All seems normal, except the Browser sync Issue.

I tried these links, but nothing seemed to work:

BrowserSync Gulp doesn't open in Chrome

Browser not launching with BrowserSync or live-server

Ray Macz
  • 85
  • 2
  • 9
  • What does the rest of your gulpfile.js look like? When I used your configuration for browsersync, I didn't have any issues. – jstoobz Jul 06 '18 at 17:48
  • @jstoobz FYI, I did not touch my gulpfile.js for almost a month with no problems & the issue happened just today, but since you asked, here it is https://github.com/raymacz/Gulpfile-Sass-/blob/master/Gulpfile.js – Ray Macz Jul 06 '18 at 19:34
  • Probably something is wrong with your chrome path. I am not sure but try reinstalling it. – harsimarriar96 Jul 08 '18 at 20:55
  • @harsimarriar96 I have tried it with Firefox, still the same issue. When I use the "run" desktop windows app, it launches Chrome with no problems. Even the directory path is correct, but I will try your advice. Thanks for the response. – Ray Macz Jul 10 '18 at 04:28
  • Try running with default settings, @RayMacz, don't give custom fields for external port etc. – harsimarriar96 Jul 10 '18 at 07:51
  • @harsimarriar96 Thanks, I already tried your suggestion. – Ray Macz Jul 11 '18 at 08:05

1 Answers1

0

Here is what worked for me:

running [ 64bit] windows 10

Node [ v6.12.2 ] Npm [ 3.10.10 ] Gulp [ Local version 3.9.1 ]

I upgraded my node & npm to:

Node [ v8.11.3 ] Npm [ 6.2.0 ] Gulp [ Local version 3.9.1 ]

when I ran "gulp", it suggested to do the ff commands:

      npm rebuild node-sass --force  // somehow node_modules (folder) was deleted
      npm install                    // reinstall node_modules (folder)
      npm audit
      npm audit fix

from here, when I ran "gulp", everything was running smoothly with no issues...

If somehow nothing works, you could check this from BrowserSync

Ray Macz
  • 85
  • 2
  • 9