M
M
massef2015-04-07 17:49:52
JavaScript
massef, 2015-04-07 17:49:52

What's wrong with gulp browser-sync plugin?

I use gulp for assembly, I connected the browser-sync plugin for the local server.
At the start of the gulp, it gives the following error . The
tunnel server offline: connect ETIMEDOUT, retry 1s
page does not open automatically. The same issue if you run the server task separately.
At the same time, the rest of the tasks work.
If you make changes in any file and save, gulp crashes and gives the following:

D:\projects\gulp_front\node_modules\browser-sync\lib\browser-sync.js:619
                bs.io.sockets.emit("file:reload", item);
                     ^
TypeError: Cannot read property 'sockets' of undefined
    at D:\projects\gulp_front\node_modules\browser-sync\lib\browser-sync.js:619:22
    at Array.forEach (native)
    at null._onTimeout (D:\projects\gulp_front\node_modules\browser-sync\lib\browser-sync.js:618:29)
    at Timer.listOnTimeout (timers.js:110:15)

Task on browser-sync registered correctly, took from office. documentation.
var config = {
  server: {
    baseDir: "./build"
  },
  tunnel: true,
  host: 'localhost',
  port: 8000,
  logPrefix: "gulp_frontend"
};

// Поднимаем вебсервер
gulp.task('webserver', function () {
  browserSync(config);
});

well, the call of the plugin at the end of the tasks
.pipe(reload({stream: true}));
Who faced, how did you decide?
Tried googling by mistake, didn't find anything useful.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
T
teotlu, 2015-04-08
@massef

Maybe your port is clogged with something (stupid version, but at least some)?

D
dbazhan, 2015-05-25
@dbazhan

The port is busy!

A
axblue, 2017-10-01
@leshikgo

Port 3000 is better to use.

R
Rostislav, 2018-12-20
@Getmanele

tunnel: true,
comment out this line and run.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question