最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ExperimentalWarning: The http2 module is an experimental API - Stack Overflow

programmeradmin5浏览0评论

I am using HAPI JS with HTTP/2 in Node JS 10.9. When I start the server using this example,

const fs = require('fs')
const Hapi = require('hapi')
const http2 = require('http2')

const server = new Hapi.Server()
server.connection({
 listener: http2.createServer(),
 host: 'localhost',
 port: 3000
})

server.route({
 method: 'GET',
 path:'/hello',
 handler: function (request, reply) {
   return reply('Hello, World!')
 }
})

server.start((err) => {
 if (err) console.error(err)
 console.log(`Started ${server.connections.length} connections`)
})

I get this warning on the console

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

I cannot find a relevant explanation on the internet that whether we can use it on Production Mode? Is it ok to use HTTP/2 on Production Mode with such warning?

I am using HAPI JS with HTTP/2 in Node JS 10.9. When I start the server using this example,

const fs = require('fs')
const Hapi = require('hapi')
const http2 = require('http2')

const server = new Hapi.Server()
server.connection({
 listener: http2.createServer(),
 host: 'localhost',
 port: 3000
})

server.route({
 method: 'GET',
 path:'/hello',
 handler: function (request, reply) {
   return reply('Hello, World!')
 }
})

server.start((err) => {
 if (err) console.error(err)
 console.log(`Started ${server.connections.length} connections`)
})

I get this warning on the console

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

I cannot find a relevant explanation on the internet that whether we can use it on Production Mode? Is it ok to use HTTP/2 on Production Mode with such warning?

Share Improve this question edited Sep 10, 2018 at 11:23 Ankur Soni asked Sep 10, 2018 at 9:35 Ankur SoniAnkur Soni 6,0185 gold badges57 silver badges88 bronze badges 3
  • 2 Which version of node.js are you using? According to documentation of 10.10, http2 is stable, so you shouldn't get that warning on the newest release. – user6019272 Commented Sep 10, 2018 at 10:23
  • Node Version 10.9 – Ankur Soni Commented Sep 10, 2018 at 11:23
  • So we should go with newer versions of node >= 10.10.0, i had this warning also on node --version v10.0.0 on my apollo server,also my server have a very slow start. – Goran_Ilic_Ilke Commented Feb 17, 2021 at 9:57
Add a ment  | 

1 Answer 1

Reset to default 7

As @DoMiNeLa10 noted the experimental warning was dropped in 10.10:

https://github./nodejs/node/pull/22716:

http2:

◦ The http2 module is no longer experimental. #22466

Good discussion here as to all the work involved in making it non-experimental: https://github./nodejs/node/issues/19453

发布评论

评论列表(0)

  1. 暂无评论