Search code examples
gulp

gulp with gulp-sequence package fail


I try to use gulp and gulp-sequence together, follow the instructions of the npm website, i just try a simple example to test if all the things works. But to my surprise the basic example does not works, someone has a tip about what the problem ?

node: v10.15.3

gulp: 4.0.1

gulp-sequence: 1.0.0

const gulp = require('gulp')
const gulpSequence = require('gulp-sequence')

gulp.task('lint', function (cb) {
  cb()
})

gulp.task('default', gulpSequence('lint'))

I expected the simple execution :

[12:01:15] Starting 'default'...
[12:01:15] Finished 'default' after 2.56 ms

But instead i received the error:

TypeError: gulp.on(...).on(...).on(...).on(...).start is not a function

Solution

  • With gulp 4, you don't need gulp-sequence and can use the built-in gulp.series function. This should work:

    const gulp = require('gulp')
    
    gulp.task('lint', function (cb) {
      cb()
    })
    
    gulp.task('default', gulp.series('lint'))