Gulp: error in console, assert.js:90 throw new assert.AssertionError

I get such an error in console: $ gulp

assert.js:90
  throw new assert.AssertionError({
  ^
AssertionError: Task function must be specified

at Gulp.set [as _setTask] (C:\Users\user\Projects\New project\node_modules\undertaker\lib\set-task.js:10:3)

at Gulp.task (C:\Users\user\Projects\New project\node_modules\undertaker\lib\task.js:13:8)

at Object.<anonymous> (C:\Users\user\Projects\New project\gulpfile.js:44:6)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)

Here is my gulpfile:

var gulp = require('gulp');
var build = require('gulp-build');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var browser_sync = require('browser-sync');
var gulps = require("gulp-series");


//gulp-build
gulp.task('build', function() {
    gulp.src('scripts/*.js')
        .pipe(build({
            GA_ID: '123456'
        }))
        .pipe(gulp.dest('dist'))
});

//gulp-sass
gulp.task('sass', function() {
    return gulp.src('scss/**/*.scss')
        .pipe(sourcemaps.init())
        .pipe(sass({
            errLogToConsole: true,
            outputStyle: 'expanded'
        }).on('error', sass.logError))
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest('css'));
});

//gulp-browser-sync
gulp.task('browser_sync', function() {
    var files = [
        '*.html',
        'css/*.css'
    ];
    browser_sync.init(files, {
        server: {
            baseDir: './'
        }
    });
});

//gulp-watch
gulp.task('watch', ['sass'], function() {
    gulp.watch('scss/**/*.scss', ['sass']);
});

//gulp-series
gulps.registerTasks({
    "test1": (function(done) {
        setTimeout(function() {
            console.log("test1 is done");
            done();
        }, 1000);
    }),
    "test2": (function() {
        console.log("test2 is done");
    })
});

gulps.registerSeries("default", ["test1", "test2"]);

// gulp.task('default', ['watch', 'browser_sync'], function() {});

I'm just a beginner, have you any idea what I've done wrong?

I think you use gulp 4 with the gulp 3 'syntax'. So either install gulp 3 and your gulpfile should be valid and ready to go or migrate it to gulp 4. Here is a good article about that.

Changelog of gulp

Error - "Task function must be specified" · Issue #54 · gulpjs , Here's the log: C:\xampp\htdocs\project>gulp assert.js:89 throw new assert.​AssertionError({ ^ AssertionError: Task function must be specified at  Welcome to Gulp. Gulp 4! Probably your tutorial is for Gulp 3. gulp.task('default', ['styles','js']); will not work in Gulp 4 due to a new task execution system

gulp 4 series(...tasks)

gulp.task('one', function(done) {
// do stuff
done();
});

gulp.task('two', function(done) {
// do stuff
done();
});

gulp.task('default', gulp.series('one', 'two', function(done) {
// do more stuff
done();
}));

see https://github.com/gulpjs/gulp/blob/4.0/docs/API.md

cant compile gulp with new npm update · Issue #792 · understrap , the gulpfile to fit the new syntax restrictions for gulp 4.0 but I am getting the following error. assert.js:42 throw new errors.AssertionError({ I just run into the same problem while upgrading to gulp 4. The depending tasks have to be specified as series or in parallel, just the name is not enough anymore.

gulp automatically installs version 4.0.0

change the version of your gulp by running below command

 npm install gulp@3.3.4 --save

This will solve your problem.

can't get gulp to work - Node.js, assert.js:42. throw new errors.AssertionError({. ^. AssertionError [​ERR_ASSERTION]: Task function must be specified. at Gulp.set [as _setTask]  Click to share on Twitter (Opens in new window) Click to share on Facebook (Opens in new window)

I resolved issue using below command

npm install --save-dev gulp@3.9.1

This will solve your problem (I resolved issue in window 7 and window 10)

Why does not Gulp run? - JavaScript, Gulp: error in console, assert.js:90 throw new assert. assert.AssertionError({ ^ AssertionError: Task function must be specified at Gulp.set [as  Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Just passed for the same error now, DAXaholic's answer is right, your gulpfile.js's gulp@3.* but you have installed gulp 4. Just install the correct version:

npm i -D gulp@3.*

javascript, gulp assert.js:42 throw new errors.AssertionError({ ^ AssertionError [​ERR_ASSERTION]: Task function must be specified at Gulp.set [as .on('error', function (err) { console.log(err); this.emit('end') }) .pipe(source('index.js'))  Re: node.js and Gulp errors When posting code, it's best to post it in snippets so that there is a clearer discretion between code and text. Next time, try using the "Insert Code" button to input your code snippets to make it easier for people to help. ♥

Node.js v13.13.0 Documentation, Я получаю такую ​​ошибку в консоли: $ Gulpassert.js:90 throw new assert.​AssertionError({ ^ AssertionError: Task function must be specified at Gulp.set [as​  I am having a problem running test-querySync-select-with-exception.js. I am getting the following error: $ node test-querySync-select-with-execption.js { Error: [IBM][CLI Driver][DB2/AIX64] SQL0104N An unexpected token "END-OF-STATEMENT" was found following "select invalid query".

assert.js:90 throw new assert.AssertionError({ ^ AssertionError: Task function must be specified at Gulp.set [as at Gulp.task (C:\Users\user\Projects\New .​pipe(sass({ errLogToConsole: true, outputStyle: 'expanded' }).on('error', sass. "​test1": (function(done) { setTimeout(function() { console.log("test1 is done"); done​(); }  Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

new Console(stdout[, stderr][, ignoreErrors]); new Console(options) All errors thrown by the assert module will be instances of the AssertionError class. const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); console.log(buf. This would allow undertaker to new up the registry and pass this in as the only argument but still allows the end user to pass in a config object.. This also allows the API to stay exactly the same gulp.registry(CustomRegistry(options)) with only a tiny wrapper overhead for registries that require configuration options.

Comments
  • A great article which might help: liquidlight.co.uk/blog/article/how-do-i-update-to-gulp-4
  • @SurajRao: This is a formal comment. In this case it is NOT NEEDED. A link is sufficient. "Michael Oxborrow" - good link, tnx.
  • Thanks for Your answer. Where can I find gulp 4 syntax? Is there a site, library with prepared functions?
  • Ok, nevermind, I found it. Sorry for stupid questions. :)
  • If someone else will maintain its own project at gulp@3.*, just install the correct version: npm i -D gulp@3.*
  • my answer helped someone. Good to hear that. @AkshayVijayJain
  • No need to specify minor versions: npm i -D gulp@3.*
  • @giovannipds, It is left to you which version to choose.I just gave an example. Thank you
  • @BasavarajHadimani I know you did, but we're intended to give the best full answers here. I would recommend update it.
  • No need to specify minor versions: npm i -D gulp@3.*
  • This would still install gulp@4.* nowadays, so it's not an appropriated answer anymore.