链接到此问题= Gulp error: The following tasks did not complete: Did you forget to signal async completion?
[当我尝试使用以下代码运行“监视”时,出现错误:
gulp.task('watch', async function() {
var watchJs = gulp.watch(paths.js, ['scripts']),
watchJson = gulp.watch(paths.json, ['json']),
watchHtml = gulp.watch(paths.html, ['html']),
watchCss = gulp.watch(paths.css, ['css']),
watchFonts = gulp.watch(paths.fonts, ['fonts']),
watchAssets = gulp.watch(paths.assets, ['assets']),
onChanged = function(event) {
console.log('File ' + event.path + ' was ' + event.type + '. Running tasks...');
}
watchJs.on('change', onChanged);
watchJson.on('change', onChanged);
watchHtml.on('change', onChanged);
watchCss.on('change', onChanged);
watchFonts.on('change', onChanged);
watchAssets.on('change', onChanged);
});
错误说:Error: watching src/js/**/*.js: watch task has to be a function (optionally generated by using gulp.parallel or gulp.series)
但是我不知道该如何处理。我尝试将异步放在gulp.task('watch',async function(){上,但不起作用
更改
var watchJs = gulp.watch(paths.js, ['scripts']), // gulp v3 syntax
to
var watchJs = gulp.watch(paths.js, gulp.serie('scripts')), // gulp v4 syntax
和您的其他人一样。查找从gulp v3到v4的迁移指南。