I
I
Ilya Naryshkin2016-02-01 23:02:52
npm
Ilya Naryshkin, 2016-02-01 23:02:52

Error when using browserSync plugin for Gulp, what should I do?

Hello
There is gulp, browserSync. I want to use it stupidly so that the browser restarts. Connected like this

var browserSync = require('browser-sync').create();
var reload = browserSync.reload;

var config = {	
    proxy: "http://feby/frontend/build/html/",
    
    host: 'localhost',
    port: 9000,
    
    logPrefix: "it`s my house!"
};

browserSync.init(config);

Calling an update, for example for such an event
gulp.task('fonts:build', function() {
    gulp.src(path.src.fonts)
        .pipe(gulp.dest(path.build.fonts))
        .pipe(notify("fonts builded!"))
        .pipe(reload());
});

The console is such a miracle
[it`s my house!] Proxying: http://feby
[it`s my house!] Access URLs:
 -----------------------------------------------------------
       Local: http://localhost:9000/frontend/build/html/
    External: http://192.168.0.105:9000/frontend/build/html/
 -----------------------------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.0.105:3001
 -----------------------------------------------------------
[22:57:36] Starting 'html:build'...
[it`s my house!] Reloading Browsers...
[22:57:36] 'html:build' errored after 42 ms
[22:57:36] TypeError: Cannot read property 'on' of undefined
    at DestroyableTransform.Readable.pipe (C:\my Program Files\OpenServer\domains\feby\frontend\node_modules\gulp-notify\node_modules\readable-stream\lib\_stream_readable.js:516:7)
    at Gulp.<anonymous> (C:\my Program Files\OpenServer\domains\feby\frontend\gulpfile.js:80:10)
    at module.exports (C:\my Program Files\OpenServer\domains\feby\frontend\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (C:\my Program Files\OpenServer\domains\feby\frontend\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (C:\my Program Files\OpenServer\domains\feby\frontend\node_modules\orchestrator\index.js:214:10)
    at Gulp.Orchestrator.start (C:\my Program Files\OpenServer\domains\feby\frontend\node_modules\orchestrator\index.js:134:8)
    at Gulp.<anonymous> (C:\my Program Files\OpenServer\domains\feby\frontend\node_modules\gulp\index.js:36:18)
    at Gaze.<anonymous> (C:\my Program Files\OpenServer\domains\feby\frontend\node_modules\glob-watcher\index.js:18:14)
    at emitTwo (events.js:87:13)
    at Gaze.emit (events.js:172:7)
[22:57:36] gulp-notify: [Gulp notification] html builded!

Such a moment that in the end it performs its function and the browser is updated, but there is some kind of error and it is annoying + with such spam you can forget about the console.
If so, then this line
at Gulp.<anonymous> (C:\my Program Files\OpenServer\domains\feby\frontend\gulpfile.js:80:10)

Points to
.pipe(reload());

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question