gulpjs / undertaker

Task registry that allows composition through series/parallel methods.
MIT License
200 stars 31 forks source link

Error - "Task function must be specified" #54

Closed yairEO closed 8 years ago

yairEO commented 8 years ago

I've updated my GULP to v4 and i'm getting this error. Here's the log:

C:\xampp\htdocs\project>gulp

assert.js:89
  throw new assert.AssertionError({
  ^
 AssertionError: Task function must be specified
    at Gulp.set [as _setTask] (C:\xampp\htdocs\project\node_modules\gulp\node_modules\undertaker\lib\set-task.js:12:3)
    at Gulp.task (C:\xampp\htdocs\project\node_modules\gulp\node_modules\undertaker\lib\task.js:13:8)
    at Object.<anonymous> (C:\xampp\htdocs\project\gulpfile.js:47:6)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Liftoff.handleArguments (C:\Users\vsync\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
bradodarb commented 8 years ago

What was the fix @yairEO ?

yairEO commented 8 years ago

@bradodarb - The fix was to go back to v3 :)

voyti commented 8 years ago

@yairEO More in-depth analysis would be appreciated, since I'm having the same issue ;)

phated commented 8 years ago

@voyti there's a great article about upgrading in our docs: https://www.liquidlight.co.uk/blog/article/how-do-i-update-to-gulp-4/

voyti commented 8 years ago

@phated All clear, thank you!

NextSeason commented 7 years ago

I got the same Error Message with a simple task :

gulp.task( 'js', () => {
    return gulp.src( 'src/**/*.js', { buffer : false } )
        .pipe( cached( 'js' ) )
        .pipe( pkg() )
        .pipe( directive() )
        .pipe( gulp.dest( 'output' ) );
} );
lucien144 commented 7 years ago

@NextSeason Have you found a solution? Having the same issue with similar simple task.

lucien144 commented 7 years ago

@NextSeason Ok, just found issue on my side in gulpfile.js with one wrong task definition -> be sure your gulpfile.js is all correct and all your tasks are written correctly!

yairEO commented 7 years ago

I've tried again last night to change to Gulp 4, and again faced an hour of nightmare compatibility issues. I managed to make it work, except gulp.watch which won't work for some reason and the internet did not present any answer.

NextSeason commented 7 years ago

@lucien144 I did not find anyway to solve this problem and reversed to V3.

lucien144 commented 7 years ago

@yairEO @NextSeason Guys, can you post here your gulpfile.js so we can check? I've got pretty complex gulpfile.coffee and switch from v3 to v4 was (after some struggling :)) pretty ok.

NextSeason commented 7 years ago

@lucien144 There are several separate javascript files and some gulp tasks written by myself, every of them might cause this error, so it's too complex to paste all of them here. I don't want to check it again, so I can't waste others' time here to read my code line by line. Maybe I will refactor my code someday If version 3 cannot satisfy my requirement or for some reasons else.

phated commented 7 years ago

These discussions belong on StackOverflow, not deep in a closed issue :frowning_face:

ku3mich commented 7 years ago

https://fettblog.eu/gulp-4-parallel-and-series/ because gulp.task(name, deps, func) was replaced by gulp.task(name, gulp.{series|parallel}(deps, func))

philipmw commented 6 years ago

Thanks. I ran into this problem too, and ku3mich's link solved my problem. This is a documentation problem at this point; https://github.com/gulpjs/gulp/blob/master/docs/API.md is still describing v3's API.