Gulp error: Did you forget to signal async completion?

家住魔仙堡 提交于 2021-02-11 12:15:42

问题


Problems with compiling what I see as a simple script using gulp. When ran it causes a "Did you forget to signal async completion?" error.

Looking at the internet this seems to be a problem with async functions and read that passing and adding the done function would resolve this. In my case this isn't the case so wondering what else I'm doing wrong.

gulp.task("compile-less", done => {
  gulp
    .src("./app/design/frontend/Playsports/theme_frontend_base/web/css/_base.less")
    .pipe(less())
    .pipe(
      gulp.dest(() => {
        return "./pub/static/frontend/Playsports/gcn/en_GB/css/";
      })
    );
  done();
});

gulp.task("default", done => {
  gulp.series("compile-less");
  done();
});

I would expect this to not error and complete the task.


回答1:


This would be the general form:

gulp.task("default", gulp.series("compile-less", done => {
  // do something else here
  done();
}));

In your case I believe this is sufficient:

gulp.task("default", gulp.series("compile-less"));


来源:https://stackoverflow.com/questions/57095013/gulp-error-did-you-forget-to-signal-async-completion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!