question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing gulp.src() to gulp.pipe() is erroring

See original GitHub issue

My gulp task:

gulp.task('build', ['sass'], function (done) {
    var child = spawn('./node_modules/.bin/r.js', ['-o', 'app/assets/js/app.build.js'], {
        stdio: 'inherit'
    });

    child.on('close', function () {
        gulp.src('app/assets/build/js/main.js')
            .pipe(gulp.dest('app/assets/build'))
            .pipe(gulp.src('app/assets/build/js', {read: false}))
            .pipe(plugins.clean())
            .on('end', done);
    });
});

My error:

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: write after end
    at writeAfterEnd (/Users/callumacrae/Sites/finance-finder/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:145:12)
    at Transform.Writable.write (/Users/callumacrae/Sites/finance-finder/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:193:5)
    at Stream.ondata (stream.js:51:26)
    at Stream.EventEmitter.emit (events.js:95:17)
    at queueData (/Users/callumacrae/Sites/finance-finder/node_modules/gulp/node_modules/vinyl-fs/node_modules/map-stream/index.js:43:21)
    at next (/Users/callumacrae/Sites/finance-finder/node_modules/gulp/node_modules/vinyl-fs/node_modules/map-stream/index.js:71:7)
    at /Users/callumacrae/Sites/finance-finder/node_modules/gulp/node_modules/vinyl-fs/node_modules/map-stream/index.js:85:7
    at done (/Users/callumacrae/Sites/finance-finder/node_modules/gulp/node_modules/vinyl-fs/lib/dest/writeContents/index.js:9:5)
    at /Users/callumacrae/Sites/finance-finder/node_modules/gulp/node_modules/vinyl-fs/node_modules/graceful-fs/graceful-fs.js:102:5
    at Object.oncomplete (evalmachine.<anonymous>:107:15)

~/Sites/finance-finder rc-2*  14s
❯ gulp --version
[17:57:19] CLI version 3.8.0
[17:57:19] Local version 3.8.0

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:39 (10 by maintainers)

github_iconTop GitHub Comments

8reactions
hohocommented, Sep 29, 2014

doctor-who-rain-sad

0reactions
phatedcommented, Nov 5, 2015

This is not your problem. Your stack trace says you fed invalid JS to uglify

Read more comments on GitHub >

github_iconTop Results From Across the Web

gulp.dest() is not creating an output file - Stack Overflow
Your first mistake is that you have gotten an incorrect path. In the gulp.src() function, you are passing a path to a folder...
Read more >
Developers - Passing gulp.src() to gulp.pipe() is erroring -
Passing gulp.src() to gulp.pipe() is erroring. wearefractal. 11 June 2014 Posted by callumacrae. My gulp task: gulp.task('build', ['sass'], function (done) ...
Read more >
How to use the gulp.on function in gulp - Snyk
To help you get started, we've selected a few gulp.on examples, based on ... the build // gulp.task('docs', function() { // return gulp.src(paths.docs) ......
Read more >
Catching errors on Gulp.js - Boris - Medium
So, now gulp can get only error from last stream, and usualy it is gulp.dest() call to write the result of task to...
Read more >
Converting code to Gulp 4.0 - The freeCodeCamp Forum
src /Assets/css'; //Compile SCSS gulp.task('compile_scss', gulp.parallel(function(){ gulp.src(SCSS_SRC) .pipe(sass().on('error', sass.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found