How to get browsersync working with jekyll and gulp

browsersync
gulp
jekyll

#1

Can someone help me out here? I’m at my wit’s end. I’ve installed jekyll, gulp and browsersync, configured gulp (to the best of my ability) and every time I run it I always get a socket.io not found error.

This is the gulpfile:

const gulp = require('gulp');
const shell = require('gulp-shell');
const browserSync = require('browser-sync').create();
const siteRoot = "_site/"
  
// task for building the site when something changed:
gulp.task('serve', shell.task(["bundle exec jekyll serve --host $IP --port $PORT --baseurl ''"]));

// task for serving blog with Browsersync
gulp.task('refresh', function(){
    browserSync.init({
        files: [siteRoot + '**'],
        server: {
            baseDir: siteRoot
        },
        notify: true,
        port:8082
    });
    //Reloads the page when some of the already build files changed:
    gulp.watch('_site/**/*.*').on('change', browserSync.reload);
});

gulp.task('default', ['serve', 'refresh']);

I’ve never used these three tools together with cloud9 before…