gruntjs / grunt-contrib-connect

Start a static web server.
http://gruntjs.com
MIT License
714 stars 146 forks source link

ExperimentalWarning: The http2 module is an experimental API. #235

Closed IceCreamYou closed 6 years ago

IceCreamYou commented 6 years ago

I am using grunt-contrib-connect@1.0.2. With Node.js v6.11.3, 8.5.0, and 8.6.0, I did not get any warnings when running any Grunt tasks. After upgrading to 8.8.0 and now 8.8.1 (I skipped 8.7.0) I am getting warnings that look like this whenever I run a Grunt task:

(node:19412) ExperimentalWarning: The http2 module is an experimental API.

I assume 19412 is the process ID.

This warning goes away after uninstalling grunt-contrib-connect. It happens regardless of whether I configure a target to use the http2 protocol or not.

It looks like this is because of this change in node v8.8.0: https://github.com/nodejs/node/pull/15685

Essentially it enables the Node.js core http2 module which now overrides the userland package. Importing the userland package now requires setting the environment variable NODE_NO_HTTP2=1.

It seems like a viable solution here would be to check whether the user is running Node 8.8.0+ and use the native http2 module if so.

toptalo commented 6 years ago

Get same warning on v8.9.0 (current LTS)

cssagogo commented 6 years ago

Get same warning on Node v9.0.0 and NPM v5.5.1

Doacola commented 6 years ago

With NODE_NO_HTTP2=1 in environment variables I tested with latest LTS v8.9.1 the warning is no longer visible but seems like it was not added or just doesn't work in v9.0.0 or v9.1.0 (Both of them were tested).

So if that warning causes that much trouble just up-/downgrade to v8.9.1LTS and that environment variable will remove the message.

So this issue is not directly caused by grunt but instead it's based on latest updates from Node and their decision to add http2 to be exposed by default. https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V8.md#2017-10-24-version-880-current-mylesborins

IceCreamYou commented 6 years ago

The OP notes the env variable workaround, but that's not a viable solution for code that needs to be distributed to others. We can't ask every user of the code to add this variable.

More importantly, setting the env variable causes grunt-contrib-connect to use the userland package which is now deprecated. It'd be nice to move onto code that will be maintained.

knoxcard commented 6 years ago

Does not work on v9.2.0 either, when will this be corrected? http2 is commonplace. It prevents my entire web platform from loading, instead a 502 Bad Gateway is returned from my frontend proxy server NGINX.

Reverting back to v8.7.0.

Any version above node v8.7.0 does NOT work for me.

XhmikosR commented 6 years ago

This is gone with the latest master changes, will be in v2.0.0 when it's out.