Skip to content

Running gulp tasks in sequence throws Unhandled stream error in pipe #2303

@aimad-majdou

Description

@aimad-majdou

What were you expecting to happen?

To run 3 tasks in sequence, the first one is just to run a build command, the second one will delete a folder and it's content, the third one will copy files from a source into a destination (which was the deleted folder).

So basically the tasks definition is as following :

gulp.task('build-files, function(cb) {
    runSequence('run-build-cmd',
        'delete-dest', 'copy-files',
        cb);
});
gulp.task('delete-dest', (cb) => {
    del([pathToDestFolder], {force: true});
    cb();
});
gulp.task('copy-files', () => {
    return gulp.src(pathToSrcFolder)
        .pipe(gulp.dest(pathToDestFolder))
        .pipe(gulp.dest(anotherPath));
});

This task will run whenever changes happened in the source folder as following :

gulp.watch(pathToSrcFolder, ['build-files']);

When I run the gulp delete-dest in cmd prompt (which will clear the pathToDestFolder) and then gulp copy-files (which will copy the source folder into two folders pathToDestFolder and anotherPath) it works as expected .

So I guess runSequence didn't work as expected ?

I tried to use rimraf instead of del, and all seems to work just fine, I know that rimraf is depricated, and it's better to use del instead, but why del in this case results in an exception ?

What actually happened?

Error was thrown:

internal/streams/legacy.js:59
      throw er; // Unhandled stream error in pipe.
      ^

Error: ENOENT: no such file or directory, chmod 'pathToDestFolder\path\to\some\file\file.ext'

What version of gulp are you using?

3.9.1

What versions of npm and node are you using?

npm -v & node -v
5.6.0
v8.9.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportThis is a support question, not an issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions