0

I'm getting the following error when I run the gulp file:

'default' errored after 64 ms [16:02:03] The following tasks did not complete: serve, sass [16:02:03] Did you forget to signal async completion?

The code is:

var gulp = require('gulp')
var browserSync = require('browser-sync').create()
var sass = require('gulp-sass')

gulp.task('compile-sass', function() {
    return gulp.src(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss'])
    .pipe(sass())
    .pipe(gulp.dest('src/css'))
    .pipe(browserSync.stream())

})

gulp.task('move-js', function() {
    return gulp.src(['node_modules/bootstrap/dist/js/bootstrap.min.js', 'node_modules/jquery/dist/jquery/jquery.min.js'])
    .pipe(gulp.dest('src/js'))
    .pipe(browserSync.stream())

})

//run sass when serve runs
//run server
//watch for any changes in src/scss folder and reload the browser
//also watch for sass changes
//watch for html changes
gulp.task('launch-server', ['compile-sass'], function() {
    browserSync.init({
        server: "./src"
    })
    gulp.watch(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss'],['compile-sass'])
    gulp.watch("src/*.html").on('change', browserSync.reload)


})

//run gulp
//launch server and browser
//execute js task
gulp.task('default', ['move-js', 'launch-server'])
Alessandra Amosso
  • 351
  • 1
  • 4
  • 13
  • Similar: https://stackoverflow.com/questions/57095013/gulp-error-did-you-forget-to-signal-async-completion – isherwood Jan 13 '20 at 16:10
  • [This](https://stackoverflow.com/questions/36897877/gulp-error-the-following-tasks-did-not-complete-did-you-forget-to-signal-async) question is also showing the same error message :) – Alessandra Amosso Jan 13 '20 at 16:14
  • Folks, many thanks for the assist. declaring the functions as async function did the trick – melspence Jan 13 '20 at 17:10

0 Answers0