avevlad / gulp-connect

Gulp plugin to run a webserver (with live reload)
https://npmjs.org/package/gulp-connect
MIT License
632 stars 113 forks source link

http2 causes issues with node 6.3.1 #197

Closed stevejhiggs closed 8 years ago

stevejhiggs commented 8 years ago

Although this is actually an issue with the http2 module. If there was a flag to switch off the http2 support it would let me work around our issue.

Steps to reproduce:

running node 6.3.1 on windows. run connect to serve a file over https. browse to the file.

The following error occurs:

`buffer.js:1028 throw new TypeError('"value" argument is out of bounds'); ^

TypeError: "value" argument is out of bounds at checkInt (buffer.js:1028:11) at Buffer.writeUInt16BE (buffer.js:1097:5) at Function.writeCommonHeader as commonHeader at Serializer._transform (C:\code\github\script-build-service\node_modules\http2\lib\protocol\framer.js:44:27) at Serializer.Transform._read (_stream_transform.js:167:10) at Serializer.Transform._write (_stream_transform.js:155:12) at doWrite (_stream_writable.js:307:12) at writeOrBuffer (_stream_writable.js:293:5) at Serializer.Writable.write (_stream_writable.js:220:11) at Compressor.ondata (_stream_readable.js:556:20)`

justinmchase commented 8 years ago

I believe if it fails to load via require it just uses default http. You could move it to an optional dependency and then not install it on your device machine

stevejhiggs commented 8 years ago

The http2 module is loaded so gulp-connect attempts to use it then crashes out.

Is the intention to have a user optionally install the http2 module if they want http2 support? If so the optional dependancy should be a peer dependancy. Optional dependancies will alway be installed but installation failure is tolerated.

stevejhiggs commented 8 years ago

updated the title because it looks like an issue in node 6.3.1 rather than windows. see https://github.com/molnarg/node-http2/issues/214

justinmchase commented 8 years ago

PR's welcome.

You could also use proxyquire to solve this fyi.

var proxyquire = require('proxyquire').noPassThru()
var gc = process.platform === 'win32' ? proxyquire('gulp-connect', { 'http2': null }) : require('gulp-connect')