Search code examples
gulp

The following tasks did not complete: serve, sass. Did you forget to signal async completion?


Other answers were not helpful. I'm using Gulp 4 on Windows 10.

I get the following error when running 'gulp serve'

The following tasks did not complete: serve, sass
[18:48:51] Did you forget to signal async completion?

My gulpfile.js

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

gulp.task('sass', function() {
    return sass('./public_html/lib/scss/main.scss')
        .pipe(gulp.dest('./public_html/css'))
        .pipe(reload({ stream:true }));
});
gulp.task('serve', gulp.series('sass', function() {
    browserSync({
        server: {
            baseDir: 'public_html'
        }
    });
    gulp.watch('lib/scss/*.scss', gulp.series('sass'));
}));

Solution

  • Try this instead:

    gulp.task('sass', function() {
    
        return gulp.src('./public_html/lib/sass/main.scss')
            .pipe(sass()).on("error", sass.logError))
            .pipe(gulp.dest('./public_html/css'))
            .pipe(reload({ stream:true }));
    });
    

    Note you need gulp.src, then a call to sass.