The following tasks did not complete: first Did you forget to signal async completion?

阅读 63

2022-07-12

The following tasks did not complete: first Did you forget to signal async completion?

在使用gulp执行task的时候,使用匿名函数经常出现以下错误:

The following tasks did not complete: first Did you forget to signal async completion?_异步请求

The following tasks did not complete: first Did you forget to signal async completion?_异步请求_02

两种解决办法

方法一:这个是最简单的一种方法使用done来进行回调,gulp会自动将这个回调函数作为一个参数返回到任务中,在完成的时候一定要调用这个函数。如下:

The following tasks did not complete: first Did you forget to signal async completion?_回调函数_03

方法二 :在异步请求机制中,是有一个Promise对象的,它包含了请求的过程中所有内容。如下:

The following tasks did not complete: first Did you forget to signal async completion?_gulp_04


精彩评论(0)

0 0 举报