-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gulp 4 task: "Did you forget to signal async completion?" #45
Comments
I think this is an issue with |
@ghpabs Try to define clean function as task. |
@TrySound I did. No luck. I managed to fix it by setting up my task as per below: gulp.task('build', gulp.series(
clean
)); |
@ghpabs Oh I understood. You should return result of call generated function like function build() {
return gulp.series(
clean
)();
} |
Setup: CLI version: 0.4.0 I'm experiencing the same problem when I define a gulp.series task with an array of sub-tasks:
I'll try wrapping all the sub-tasks into a function like @ghpabs did, but gulp.series should be able to work like this anyway. |
@Nocomm I'm sure that named tasks should be defined as tasks not functions. I mean if you pass strings in gulp.series you should define that tasks not only functions. |
My problem turned out to be totally unrelated to this, sorry. However, I think this
can also include a list
instead of an array. Both syntaxes work fine. |
My suggestion is: var del = require('del');
function clean(cb) {
del(['docs', 'coverage', 'build', 'release']);
cb();
}
gulp.task('build', gulp.series(clean)); |
@QuoniamYIF That doesn't work, See Sample Personally I use this: // gulp v3
gulp.task('clean', del.bind(null, ['docs', 'coverage', 'build', 'release']));
// gulp v4
exports.clean = del.bind(null, ['docs', 'coverage', 'build', 'release']); See Function.prototype.bind() - Partially applied functions (currying) for details. |
I did this to solve the issue. Idk why it works it just works
|
@AquilaSagitta's solution worked for me. It seems like this issue arises anytime you have a task or subtask that runs multiple functions, because JavaScript is asynchronous. So any task that calls more than one function needs to call done, which will wait for all the tasks to finish & then exit that block of the promise. Under the hood I suspect that calling So in @AquilaSagitta's example, it's probably either Here's where the error arose for me:
And the fix was to add the
|
Was having same error but after proper reading of the above solution it worked for me, below is my code. var gulp = require('gulp'); // A function to help grab the css file gulp.task('shop', function(resolve){
//Calling the function param which is "resolve" did the magic |
@agilestrings You should return stream so task could track its state. Calling resolve like you did does not actually solve the problem. Stream continue do the work.
|
You're right sir @TrySound i noticed that " Autoprefixer " is not working. Help throw more light for more understanding. Thank you sir. |
Thanks @TrySound i have figure it out and everything is working fine. below is my code. var gulp = require('gulp'); gulp.task('styles', function(){ gulp.task('watch', function(){ |
Hi all, [14:24:26] '' errored after 1.23 min |
and this is my code gulp.task( // This is the production build for your app |
@AquilaSagitta solution work for me |
@AquilaSagitta @slsriehl solution worked for me. It seems like this issue arises anytime you have a task or subtask that runs multiple functions, because JavaScript is asynchronous. So any task that calls more than one function needs to call done, which will wait for all the tasks to finish & then exit that block of the promise. Under the hood I suspect that calling gulp returns a promise, and each task requires a promise resolve or reject because recent versions of node require explicit promise resolutions, probably to do with supporting async/await syntax. In a task that only calls one function, returning the function seems to suffice. So in @AquilaSagitta's example, it's probably either styles or scripts in gulp.parallel that needs to call done. I THINK that every gulp method automatically returns the gulp promise on complete, but gulp.parallel might not? -- so it could be gulp.parallel throwing the promise error. Here's where the error arose for me: gulp.task( Webpack:dev threw the error, and watch-proxy also threw the error, because its return value depends on the return values of its children. webpack:dev looked like this: gulp.task( And the fix was to add the done parameter to a function in webpack:dev & call it at the end. gulp.task( |
Imports:
In one line:
Or, In two lines:
Finally: |
This solved my issue:
|
Setup
del v2.1.0
Windows 7
Tasks
Error
Am I missing something?
The text was updated successfully, but these errors were encountered: