Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Lisa Crandall
Lisa Crandall
3,409 Points

Default Gulp task outputs errors.

When I run gulp as a command I get the following errors:

assert.js:351
    throw err;
    ^

AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask] (/Users/lisacrandall/Downloads/Stage1Video3/node_modules/undertaker/lib/set-task.js:10:3)
    at Gulp.task (/Users/lisacrandall/Downloads/Stage1Video3/node_modules/undertaker/lib/task.js:13:8)
    at Object.<anonymous> (/Users/lisacrandall/Downloads/Stage1Video3/gulpfile.js:10:6)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (internal/modules/cjs/helpers.js:22:18)

My code looks like this:

'use strict';

var gulp = require('gulp');

gulp.task("hello", function(done) {
    console.log("Hello!");
    done();
});

gulp.task("default", ["hello"], function() {
    console.log("This is the default task!");
});

Any help would be appreciated.

1 Answer

Gulp 4.0 has changed the way that tasks should be defined if the task depends on another task to execute. The list parameter has been deprecated.

Instead of the list parameter they have introduced gulp.series() and gulp.parallel().

https://github.com/gulpjs/gulp/blob/master/docs/recipes/running-tasks-in-series.md