title: Why is browser-sync with gulp not working
body: <h1>After following the <a href="https://www.browsersync.io/docs/gulp" rel="nofollow noreferrer">browsersync</a> docs this is what I came up with:</h1>
  <pre><code>const gulp = require('gulp'),
     sass = require('gulp-sass'), 
     concat = require('gulp-concat'),
     browserSync = require('browser-sync').create();
  
  gulp.task('watch', ['style', 'concatjs'], (cb) =&gt; {
     browserSync.init({
        server: {
           baseDir: &quot;./src/&quot;
        }
     });
  
     gulp.watch('./assets/scss/**/*.scss', ['style']);
     gulp.watch('./assets/js/**/*.js', ['concatjs']);
     gulp.watch('./**/*.html').on('change', browserSync.reload);
     gulp.watch('./**/*.php').on('change', browserSync.reload);
     cb();
  });
  
  // Process scss files to css and autoprefix
  gulp.task('style', (cb) =&gt; {
     gulp.src('./src/assets/sass/**/*.scss')
        .pipe(sass())
        .pipe(cssprefix('last 2 versions'))
        .on('error', (err) =&gt; {
           console.log(`Error: ${err.message} on line: ${err.lineNumber} in: ${err.fileName}`)
        })
        .pipe(gulp.dest('./src/assets/css'))
        .pipe(browserSync.stream());
     cb();
  });
  
  // Concat `js` files to the `main.js` file
  gulp.task('concatjs', (cb) =&gt; {
     gulp.src('./src/assets/js/*.js')
        .pipe(concat('main.js'))
        .on('error', (err) =&gt; {
           console.log(`Error: ${err.message} on line: ${err.lineNumber} in: ${err.fileName}`)
        })
        .pipe(gulp.dest('./src/assets/js'))
        .pipe(browserSync.stream());
     cb();
  });
  </code></pre>
  <p>After thorough research I found similar questions <a href="https://stackoverflow.com/questions/36918358/browser-sync-not-working-with-gulp-when-sass-updated">here</a> and <a href="https://stackoverflow.com/questions/31041823/browser-sync-not-reloading-with-gulp">here</a> but none of them addressed my issue.</p>
  <p>I was expecting the <code>watch task</code> would run the <code>style task</code> and <code>concatjs task</code> before <em>loading</em> the changes to the browser but instead am getting an error:</p>
  <pre><code>assert.js:339
      throw err;
      ^
  
  AssertionError [ERR_ASSERTION]: Task function must be specified
      at Gulp.set [as _setTask] (C:\wamp64\www\Project\node_modules\undertaker\lib\set-task.js:10:3)
      at Gulp.task (C:\wamp64\www\Project\node_modules\undertaker\lib\task.js:13:8)
      at Object.&lt;anonymous&gt; (C:\wamp64\www\Project\gulpfile.js:28:6)
      at Module._compile (internal/modules/cjs/loader.js:776:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
      at Module.load (internal/modules/cjs/loader.js:653:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
      at Function.Module._load (internal/modules/cjs/loader.js:585:3)
      at Module.require (internal/modules/cjs/loader.js:690:17)
      at require (internal/modules/cjs/helpers.js:25:18)
  </code></pre>