gulp遇到错误:The following tasks did not complete: default Did you forget to signal async completion?

 

// 添加结束回调done()
gulp.task('A' , function(){
  console.log('A') 
  done()
});
gulp.task('B' , function(done){ 
   console.log('B')
   done()
});

gulp.task('my-task', gulp.series("A","B", function(done){
    console.log("AB")
    done()
}))

原因:因为gulp不再支持同步任务.因为同步任务常常会导致难以调试的细微错误,例如忘记从任务(task)中返回 stream。

当你看到 "Did you forget to signal async completion?" 警告时,说明你并未使用前面提到的返回方式。你需要使用 callback 或返回 stream、promise、event emitter、child process、observable 来解决此问题。具体详情请看API的异步执行

 

 

 

 

 

参考:

https://blog.csdn.net/WU5229485/article/details/90173693

https://www.cnblogs.com/chorkiu/p/11435774.html

https://www.cnblogs.com/chorkiu/category/1537759.html

 

==================

gulp 将开发流程中让人痛苦或耗时的任务自动化,从而减少你所浪费的时间、创造更大价值。

中文文档:

https://www.gulpjs.com.cn/

 

posted @ 2020-04-19 17:52  月月coding  阅读(477)  评论(0)    收藏  举报