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

javascript - Gulp browser-sync ENOENT error - Stack Overflow

programmeradmin0浏览0评论

Running gulp serve, results in the following error:

[BS] [debug] Getting option: socket.path
[BS] [debug] Getting option: socket.namespace

events.js:72
        throw er; // Unhandled 'error' event
          ^
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)

It only appears, when running browser-sync, here's my browser-sync config:

browserSync({
    notify: false,
    server: {
        baseDir: ['app']
    },
    watchOptions: {
        debounceDelay: 250
    },
    startPath: "/" + view + ".html",
    injectChanges: true,
    logLevel: "debug",
    browser: ["google chrome"] 
});

I'm running the following versions:

node: 0.10.33 gulp: 3.8.10 browser-sync: 1.8.2 (also tried 1.9.x)

The startpath is correct and exists, disabling ghostMode doesnt help.

Running gulp serve, results in the following error:

[BS] [debug] Getting option: socket.path
[BS] [debug] Getting option: socket.namespace

events.js:72
        throw er; // Unhandled 'error' event
          ^
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)

It only appears, when running browser-sync, here's my browser-sync config:

browserSync({
    notify: false,
    server: {
        baseDir: ['app']
    },
    watchOptions: {
        debounceDelay: 250
    },
    startPath: "/" + view + ".html",
    injectChanges: true,
    logLevel: "debug",
    browser: ["google chrome"] 
});

I'm running the following versions:

node: 0.10.33 gulp: 3.8.10 browser-sync: 1.8.2 (also tried 1.9.x)

The startpath is correct and exists, disabling ghostMode doesnt help.

Share Improve this question asked May 7, 2015 at 8:46 ThargorThargor 7295 silver badges20 bronze badges 1
  • Problem was the following line: browser: ["google chrome"] I thought I tried that already, but apperantly not. If anyone knows why that doesn't work, this would be nice. – Thargor Commented May 7, 2015 at 8:58
Add a ment  | 

4 Answers 4

Reset to default 9

Try this: browser: 'google-chrome'

I found this ment to provide the best option:

browser: process.platform === 'darwin' ? 'MAC_OS_X_SPECIFIC_BROWSER' : 'OTHER'

Have you tried with ?

browserSync({browser: ['chrome']});

browser: 'google-chrome' - is the correct config. When you configuring your BrowerSync use 'google-chrome' with dash instead of 'google chrome' or 'chrome'. So your config should look like:

browserSync({ 
  notify: false, 
  server: { baseDir: ['app'] }, 
  watchOptions: { debounceDelay: 250 }, 
  startPath: "/" + view + ".html", 
  injectChanges: true, 
  logLevel: "debug", 
  browser: "google-chrome" 
});
发布评论

评论列表(0)

  1. 暂无评论