Gulp error report, assertionerror [err_ ASSERTION]: Task function must be specified

Async must be added before the callback function of task task to form an asynchronous function. For example:

gulp.task('cssmin', async() => {
    gulp.src(['./src/css/*.less', './src/css/*.css'])
        .pipe(less())
        .pipe(csso())
        .pipe(gulp.dest('./dist/css'));
});

There are also hints in the error message:
The following tasks did not complete: default, < anonymous>
Did you forget to signal async completion?
 
Build the global task call to report an error, such as:
PS C:\Users\J\Desktop\demo\gulp-demo> Gulp assert. Js: 385
throw err;
^
AssertionError [ERR_ASSERTION]: Task function must be specified
at gulp. set [as _setTask] (C: Users\J\node_modules\ lib\set-task.js:10:3)
at gulp. Task (C: \ Users \ \ J node_modules \ undertaker \ lib \ task js: 8)
the at Object. & lt; anonymous> (C: \ Users \ \ Desktop \ demo \ J gulp – demo \ gulpfile js: 60:6)
at the Module. The _compile (internal/modules/CJS/loader. Js: 1176:30)
at the Object. The Module. _extensions.. Js (internal/modules/CJS/loader. Js: 1196:10)
at the Module. The load (internal/modules/CJS/loader. Js: 1040:32)
at the Function, the Module. _load (internal/modules/CJS/loader. Js: 929:14)
the at The Module. The require (internal/modules/CJS/loader. Js: 1080:19)
at the require (internal/modules/CJS/helpers. Js: 72:18)
at the execute (C:\Users\J\AppData\ NPM \node_modules\gulp-cli\lib\versioned\^4.0.0\index.js:36:18) {
generatedMessage: false,
code: ‘ERR_ASSERTION’,
actual: false,
expected: True,
operator: ‘= =’
}
 
Simply prefix the function name of the call with Gulp.Series

gulp.task('default', gulp.series(['htmlmin', 'cssmin', 'jsmin', 'copy', async(done) => done]))

 

Read More: