简体   繁体   中英

GUlp - following tasks did not complete

I'm using gulp 4, and i have the following gulpfile.js:

'use strict';
var gulp = require('gulp'), del = require('del');

gulp.task('copy-fonts', () => {
    return gulp.src(['node_modules/ng/resources/fonts/**/*'])
        .pipe(gulp.dest('apps/src/assets/fonts'));
});

gulp.task('clean-copy', () => {
    del(['apps/src/assets/fonts']);
});

gulp.task('copy-assets', gulp.series(['clean-copy', 'copy-fonts']), (done) => {
    console.log("Gulp is running...");
    done();
});

When i run this command: gulp copy-assets , i get the below error:

[11:59:06] The following tasks did not complete: copy-assets
[11:59:06] Did you forget to signal async completion?

In this code:

gulp.task('copy-assets', gulp.series(['clean-copy', 'copy-fonts']), (done) => {
    console.log("Gulp is running...");
    done();
});

the task has three arguments - that is gulp v3 syntax, not gulp 4. So change that to

gulp.task('copy-assets', gulp.series(['clean-copy', 'copy-fonts'], (done) => {
    console.log("Gulp is running...");
    done();
));

The done return is now within the gulp.series arguments. Also make this change, I think it will be necessary:

gulp.task('clean-copy', (cb) => { 
  del(['apps/src/assets/fonts'] ); 
  cb(); 
}); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM