Hello, I'm running node 0.12.7, npm 2.11.3 on Win7, and running this code returns a 'Task default is not in your gulpf file':
[11:43:50] Using gulpfile ~\Web\mywebsite\gulpfile.js
[11:43:50] Task 'default' is not in your gulpfile
[11:43:50] Please check the documentation for proper gulpfile formatting
This is the code
var gulp = require('gulp'),
watch = require('gulp-watch'),
jade = require('gulp-jade'),
less = require('gulp-less');
// functions ----------------------
gulp.task('default', ['compile']);
gulp.task('compile', function() {
return gulp.src('./less/*.less')
.pipe(less())
.pipe(gulp.dest('./css'));
})
This are my installed modules:
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
Thanks
maybe you should put the
gulp.task('default', ['compile']);
after the compile task was defined? you can not bind the compile task into default before decare it?
Thanks ilovezy, that fixed the issue.
Am I mistaken if I say this is a workaround? On the mac platform hoisting seems to work fine
I'm not sure,I'm saving money to buy a mac, it seems a little expensive to me now
I'd reopen this, I don't think the order of the task should be that important.
It's not the gulp's problem,I think it's beacuse Javascript it self๏ผ gulpfile.js is just a js file
like this
console.log(message)
var message = 'hello cc'
you can only get : message is not defined ,
maybe there will be a way to finish this,
perhaps the default will not be decared if the tasks are not found
This is related to where the tasks are defined prior to their use. JS natively hoists variables as can be found here but i'm not sure if that is different for node/gulp i'd assume not.
This is another good example explaining complications here.
I think this should be closed as theirs nothing gulp can really do. You could use manual hoisting by defining name function variables as opposed to defining them in gulp.task that should cause them to be hoisted.
Most helpful comment
maybe you should put the
gulp.task('default', ['compile']);
after the compile task was defined? you can not bind the compile task into default before decare it?