leeda-cloud
[Gulp] The following tasks did not complete: Did you forget to signal async completion? 에러 해결법 본문
에러
[Gulp] The following tasks did not complete: Did you forget to signal async completion? 에러 해결법
leeda-cloud 2023. 4. 14. 10:04gulp 작업 중 이런 식으로 문구가 뜨며 제대로 작동하지 않았다.
The following tasks did not complete: dev
Did you forget to signal async completion?
찾아보니 비동기 작업이 완료되지 않았기 때문이라는데 이를 해결하기 위해 찾아보니 방법이 자세하게 적혀있는 걸 찾았다.
Gulp error: The following tasks did not complete: Did you forget to signal async completion?
I have the following gulpfile.js, which I'm executing via the command line gulp message: var gulp = require('gulp'); gulp.task('message', function() { console.log("HTTP Server Started"); }); I'm
stackoverflow.com
여기에 여러 가지 방법이 적혀있는데 제일 쉬운 방법은 콜백함수를 호출하는 것이다.
gulp.task('message', function(done) {
console.log("HTTP Server Started");
done();
});
이걸 화살표 함수로 아래처럼 사용했다.
const message = (done) => {
console.log("HTTP Server Started");
done();
}
혹은 Promise나 async를 이용하는 방법도 있다.
gulp.task('message', function() {
return new Promise(function(resolve, reject) {
console.log("HTTP Server Started");
resolve();
});
});
화살표 함수로 적용 시에는 이렇게.
const message = () => {
return new Promise(function(resolve) {
console.log("HTTP Server Started");
resolve();
});
});
이 방법을 사용하자 문제의 문구가 사라졌다!
'에러' 카테고리의 다른 글
Npm ERR code EJSONPARSE Failed to parse json 에러 해결법 (0) | 2023.11.08 |
---|---|
Cannot use import statement outside a module 에러 해결법 (0) | 2023.11.08 |
[chrome] 크롬 브라우저 커서 깜빡임 해결법 (0) | 2023.01.25 |
[Gulp] failed to load external module babel/register 해결법 (0) | 2023.01.06 |
[Git] not a git repository (or any of the parent directories): .git 해결법 (0) | 2023.01.05 |