Skip to content
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

gzip an image file #22

Open
NandoSangenetto opened this issue Feb 17, 2017 · 0 comments
Open

gzip an image file #22

NandoSangenetto opened this issue Feb 17, 2017 · 0 comments

Comments

@NandoSangenetto
Copy link

NandoSangenetto commented Feb 17, 2017

Hello,

I'm getting some an error when I try to run a gulp script with gulp-connect and connect-gzip.
The problem is when I try to gzip an image file, the image is gziped and sent to the browser, but the server crashes.

This is my code:

const connect = require('gulp-connect'),
      connectGzip = require('connect-gzip');

gulp.task('connect', function() {
  connect.server({
    root: 'public',
    livereload: false,
    port: 8080,
    middleware: () => {
      return [
        connectGzip.gzip({ matchType: /text|javascript|json|image/ })
      ];
    }
  });
});

This is the error:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at ServerResponse.write (_http_outgoing.js:443:15)
    at Socket.<anonymous> (/Users/user/project/node_modules/connect-gzip/lib/gzip.js:93:15)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:551:20)

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/Cellar/node/7.3.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.3.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `./node_modules/gulp/bin/gulp.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script './node_modules/gulp/bin/gulp.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the project package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./node_modules/gulp/bin/gulp.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs project
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls project
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/user/project/npm-debug.log

Can anyone help me with this problem? It's a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant