AssertionError [ERR_ASSERTION]: Task Function Must Be Specified error occurs in JavaScript because starting from Gulp.js version 4, the “list parameter has been deprecated.”
Overview of error and solution
How to fix the error?
To fix the Task Function Must Be Specified error, use the “gulp.series() and gulp.parallel()” functions. These functions allow a more explicit and readable way to define the order and concurrency of task execution.
gulp.series()
The gulp.series() function runs the provided tasks sequentially, one after the other:
gulp.task('default', gulp.series('task1', 'task2', function(done) {
// 'task1' would run first, then 'task2', and then this function
done();
}));
gulp.parallel()
The gulp.parallel() function runs the provided tasks concurrently, all at the same time.
gulp.task('default', gulp.parallel('task1', 'task2', function(done) {
// 'task1', 'task2', and this function would all start at the same time
done();
}));
You can also mix and match gulp.series() and gulp.parallel() to create more complex task execution patterns:
gulp.task('default', gulp.series('task1', gulp.parallel('task2', 'task3'), 'task4'));
In this code example:
- The task1 will run first.
- Once task1 has been completed, task2 and task3 will run in parallel.
- After both task2 and task3 have been completed, task4 will run.
If migrating from Gulp 3 to Gulp 4, you must refactor your task definitions to use these new functions.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.