Search code examples
gulp

Task never defined when using gulp series


I took this from the Gulp documentation:

const { series, parallel } = require('gulp');

function clean(cb) {
  console.log("clean");
  cb();
}

function css(cb) {
  console.log("css");
  cb();
}

function javascript(cb) {
  console.log("javascript");
  cb();
}

exports.build = series(clean, parallel(css, javascript));

When I run this with gulp build, I get:

Task never defined: build 

If I run ./node_modules/.bin/gulp build, it works.

And if I change the exports to:

exports.build = css

and run with gulp build, then it works too.

What am I doing wrong?

I've tried this on the WSL (Linux, my default env), but also on Windows directly. Another developer on my team doesn't have this issue, although he is running on a Mac. I've also tried different versions of Node.


Solution

  • Updating from gulp v4.0.0 to v4.0.1 fixes this issue.