最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - gulp browser sync open chrome only - Stack Overflow

programmeradmin9浏览0评论

I am attempting to open Chrome and Firefox when browser-sync module initializes the web server.

My gulp task has the following:

browserSync.init(null, {
  files: config.destination.root + '/**/*',
  browser: ["google chrome", "firefox"],
  port: config.port,
  notify: false,
  server: {
    baseDir: config.destination.root
  },
  startPath: config.pocSuffix
}, callback);

My current default is set to IE.

It is still opening only IE. How do i troubleshoot this?

I am attempting to open Chrome and Firefox when browser-sync module initializes the web server.

My gulp task has the following:

browserSync.init(null, {
  files: config.destination.root + '/**/*',
  browser: ["google chrome", "firefox"],
  port: config.port,
  notify: false,
  server: {
    baseDir: config.destination.root
  },
  startPath: config.pocSuffix
}, callback);

My current default is set to IE.

It is still opening only IE. How do i troubleshoot this?

Share Improve this question asked Jul 10, 2014 at 21:26 RomanRoman 1,2272 gold badges18 silver badges27 bronze badges 3
  • 2 I am still not quite sure why the IE was being fired, but i was able to fix the issue by providing browser: "chrome" option. – Roman Commented Jul 22, 2014 at 5:18
  • I'm having the same issue but I'm trying to open it in Safari, passing "safari" as an option doesn't work though... – ithil Commented Jan 21, 2016 at 15:20
  • @ithil were you able to fix it eventually, want me to test it on my end? What version of browser-sync are you using? – Roman Commented Feb 17, 2016 at 20:04
Add a ment  | 

1 Answer 1

Reset to default 5

To me it seems that neither "google chrome" nor "firefox" was found in your instance, and that IE then kicked in as the default one.

In my scenario I have a Ubuntu 15.10 minimal install with openbox, and chrome set as default browser. Various configurations and results follows:

  1. No browsersync browser set. spawns firefox
  2. "google chrome" set. error: spawn google chrome ENOENT.
  3. "chrome" set. error: spawn google chrome ENOENT.
  4. "google-chrome" set in browsersync. spawns chrome

Using "chrome" solved it for you. Using "google-chrome" solved it for me.

Mentioning it as an answer, in case someone ends up here by googling the issue.

发布评论

评论列表(0)

  1. 暂无评论