Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从gulp版本3转换为gulp版本4时面临的问题_Gulp - Fatal编程技术网

从gulp版本3转换为gulp版本4时面临的问题

从gulp版本3转换为gulp版本4时面临的问题,gulp,Gulp,在gulp版本3中,我的helpgulp任务定义为: gulp.task('help', function() { var command = chalk.bold.green; console.log(command('gulp build-task') + ': runs certain build tasks'); }); gulp.task('default', ['help']); 我执行以下操作以将其转换为第4版的吞咽: gulp.task('help', function(

gulp版本3中,我的
help
gulp任务定义为:

gulp.task('help', function() {
 var command = chalk.bold.green;
 console.log(command('gulp build-task') + ': runs certain build tasks');
});

gulp.task('default', ['help']);
我执行以下操作以将其转换为第4版的吞咽:

gulp.task('help', function() {
 var command = chalk.bold.green;
 console.log(command('gulp build-task') + ': runs certain build tasks');
});

gulp.task('default', gulp.series('help'));
[01:58:01] The following tasks did not complete: default, help
[01:58:01] Did you forget to signal async completion?
运行
gulp
时,我看到以下错误:

gulp.task('help', function() {
 var command = chalk.bold.green;
 console.log(command('gulp build-task') + ': runs certain build tasks');
});

gulp.task('default', gulp.series('help'));
[01:58:01] The following tasks did not complete: default, help
[01:58:01] Did you forget to signal async completion?
另外,我希望先运行
帮助
任务,然后运行
默认值
。在我的版本4示例中,
default
首先运行

有人能帮我吗?谢谢大家!

有很多方法可以解决这个问题。最简单的一个-您的函数应该返回(使用):

稍加清理后:

async function help() {
    const command = chalk.bold.green;
    console.log(command('gulp build-task') + ': runs certain build tasks');
};

gulp.task('default', gulp.series(help));