Http-server: DeprecationWarning for OutgoingMessage.prototype._headers

Created on 3 Jun 2019  路  7Comments  路  Source: http-party/http-server

Accessing the HTTP server throws a DeprecationWarning for OutgoingMessage.prototype._headers on Node version 12.3.1.

const puppeteer = require('puppeteer')
const httpServer = require('http-server')
const server = httpServer.createServer({ root: 'dist/html/' })
server.listen(8080)

const browser = await puppeteer.launch({
  headless: true,
  args: ['--no-sandbox', '--disable-setuid-sandbox']
})

const page = await browser.newPage()
await page.goto('http://localhost:8080', { waitUntil: 'networkidle0' })

What did you expect to happen?

No deprecation warning.

What actually happened?

Got the following warning:

(node:59243) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated

If the issue is a feature request, what is the motivation / use case for it?

Tell us about your environment

  • http-server version: 0.11.1
  • Platform: Mac (Node 10.14.5 12.3.1)

Most helpful comment

Is there an ETA when this will be resolved?

All 7 comments

The same occurs when using http-server from the command line. I wonder if this could be resolved?

I am having the same problem when running http-server (local).

I have a simple angular app:
1 - ng build --prod
2 - go to dist/{name-app}
3 - run http-server

when browsing the url i get the following error:

image

image

This is an issue in union (flatiron/union#64) which we're planning to remove from http-server down the road (#483). I'm not going to close this issue though, to ensure we make sure it goes away after #483 is resolved.

node -v 10.x is solved. thanks

Is there an ETA when this will be resolved?

Continuing @rsail 's comment: ... and what can we do in the meanwhile (as a quick hotfix)?
[EDIT] I found a similar tool called serve, I hope this helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JonFranchi picture JonFranchi  路  6Comments

arthurkhlghatyan picture arthurkhlghatyan  路  3Comments

laughinghan picture laughinghan  路  5Comments

jondlm picture jondlm  路  6Comments

isomorphisms picture isomorphisms  路  5Comments