0

I'm new to Gulp and Babel otherwise I would say more regarding this problem. I believe I installed Babel correctly including:

npm install babel-preset-es2015 --save-dev

However I currently get this error:

The following tasks did not complete: scripts

Did you forget to signal async completion?

var gulp = require("gulp");
var babel = require("gulp-babel");

gulp.task('scripts', function() {
    return gulp.src("app/js/app.js")
        .pipe(babel())
        .pipe(gulp.dest("dist/js"));
});

gulp.task('watch', function() {
    gulp.watch('app/js/app.js', 'scripts');
});

gulp.task('default', gulp.parallel('scripts', 'watch'));
Community
  • 1
  • 1
rpeg
  • 228
  • 3
  • 14

1 Answers1

1

You can't just pass the name of a task to gulp.watch(), you have to pass it a function. You can use gulp.series() or gulp.parallel() to generate one that simply calls the task it is given:

gulp.watch('app/js/app.js', gulp.series('scripts'));
Sven Schoenung
  • 30,224
  • 8
  • 65
  • 70
  • I've shortened it to this: var gulp = require("gulp"); gulp.task('scripts', function() { console.log('scripts'); }); gulp.task('default', gulp.parallel('scripts')); Still doesn't work. – rpeg May 13 '16 at 06:50
  • That's completely different code and therefore a completely different problem. This time it doesn't work because you're not calling the callback function: `function(cb) { console.log('scripts'); cb(); }` – Sven Schoenung May 13 '16 at 06:54
  • Also read [this answer](http://stackoverflow.com/questions/36897877/gulp-error-the-following-tasks-did-not-complete-did-you-forget-to-signal-async/36899424#36899424) – Sven Schoenung May 13 '16 at 06:57
  • Sorry, I got ahead of myself. I made the change you suggested and it didn't work. So I made additional changes but you're right, it's a different question. – rpeg May 13 '16 at 06:57