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.

I did a recent update to libsass and this is the error that I keep getting: [gulp-sass] write after end

After some reading around, it seems to be a common error in some other packages. My css is still being built just fine.

Here is a bit more detailed error:

[13:21:07] Starting 'sass'...

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write after end
    at writeAfterEnd (/Dev-Projects/Forty-Eta/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:144:12)
    at DestroyableTransform.Writable.write (/Dev-Projects/Forty-Eta/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:192:5)
    at write (/Dev-Projects/Forty-Eta/node_modules/gulp-css-globbing/node_modules/vinyl-map/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
    at flow (/Dev-Projects/Forty-Eta/node_modules/gulp-css-globbing/node_modules/vinyl-map/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
    at DestroyableTransform.<anonymous> (/Dev-Projects/Forty-Eta/node_modules/gulp-css-globbing/node_modules/vinyl-map/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:613:7)
    at DestroyableTransform.EventEmitter.emit (events.js:92:17)
    at onwriteDrain (/Dev-Projects/Forty-Eta/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:300:12)
    at afterWrite (/Dev-Projects/Forty-Eta/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:288:5)
    at onwrite (/Dev-Projects/Forty-Eta/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:281:7)
    at WritableState.onwrite (/Dev-Projects/Forty-Eta/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:106:5)

Here is my task:

var gulp         = require('gulp'),
    sass         = require('gulp-sass'),
    sourcemaps   = require('gulp-sourcemaps'),
    gulpFilter   = require('gulp-filter'),
    handleErrors = require('../util/handleErrors'),
    config       = require('../config'),
    autoprefixer = require('gulp-autoprefixer'),
    livereload   = require('gulp-livereload'),
    globbing     = require('gulp-css-globbing');

gulp.task('sass', function () {
  return gulp.src(config.sass.src)
    .pipe(sourcemaps.init())
    .pipe(globbing(config.sass.globbing))
    .pipe(sass(config.sass.settings))
    .on('error', sass.logError)
    .pipe(sourcemaps.write())
    .pipe(autoprefixer(config.autoprefixer))
    .pipe(gulp.dest(config.sass.dest))
    .pipe(livereload());
  return gulp.src(config.sass.src);
});

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
macmladencommented, Oct 8, 2015

It did took some time to make this and to test so here is repository: https://github.com/macmladen/globbing-test

Explanations are in the root in README.md file.

There are four branches with different outcomes:

  • master — fails, it has all of three things that breaks with Error: write after end
  • gulp-glob — passes if only gulp globbing is turned off for directories
  • css-glob — passes if we use gulp globbing but not gulp-css-globbing
  • mixin-in-scss — both globbing there but no mixins in imported partials

If I can do anything to help, feel free to ask.

0reactions
xzyfercommented, May 10, 2016

I am unable to reproduce this with v2.3.1. If the issue persists with latest gulp-sass please open an update issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Write After End error in node.js webserver - Stack Overflow
I am struggling with my node.js hobby project due to a "write after end" Error. I have a created a node.js webserver that...
Read more >
Error: write after end (Example) | Treehouse Community
Node is asynchronous, which means that functions happen at the same time. Write after end means that something is being written after the ......
Read more >
Node.js Stream writable.end() Method - GeeksforGeeks
The writable.end() method is an inbuilt application programming interface of Stream module so that no more data can be written to the Writable ......
Read more >
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
Anytime the flow goes into res.code().end() it throws ERR_STREAM_WRITE_AFTER_END . If I use return it seems to work fine. if (! ...
Read more >
Object Storage upload: [ERR_STREAM_WRITE_AFTER_END]
Hey guys! I use aws-sdk for NodeJS for Linode Object Storage but I get the following error `[ERR_STREAM_WRITE_AFTER_END]: write after end` when uploading ......
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