升级到gulp 4后gulp watch出现问题

升级到gulp 4后gulp watch出现问题,gulp,gulp-watch,Gulp,Gulp Watch,链接到此问题= 当我尝试使用以下代码运行watch时,它会显示错误: 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

链接到此问题=

当我尝试使用以下代码运行watch时,它会显示错误:

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任务必须是使用gulp.parallel或gulp.series生成的可选函数

但我不知道该怎么做。我试着把异步函数放在gulp.task'watch',异步函数{上,但是没有用

 var watchJs = gulp.watch(paths.js, ['scripts']),  // gulp v3 syntax

找到一个从GulpV3到v4的迁移指南

 var watchJs = gulp.watch(paths.js, gulp.serie('scripts')),  //  gulp v4 syntax