http-server
http-server copied to clipboard
DeprecationWarning for OutgoingMessage.prototype._headers
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)
https://github.com/flatiron/union/pull/64
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:


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.
Always the problem with very latest build (April 2021). An estimated ETA or fix would be greatly appreciated
Over 2 years now. How much longer until this is fixed?
I was running another server on same port (using XAMPP server). I stopped XAMPP and restarted my cmd and its working now.
Still the bug alive? or it is solved?
This is an upstream bug in the dependency union, which is more or less unmaintained. #483 seeks to remove it, but it will take some substantial work. For the time being, I'm not aware of plans to imminently remove the _headers property in Node, so we're not at a crisis point yet. I may not have the time to get to #483 for a while, and would welcome any PRs.
This issue has been inactive for 180 days
Still happening
Can't believe it's now 2022 and the bug still exists... Orz
I have met the same error
+1
+2
+3
Any updates on this?
Might be useful to spin a new version of union fixing just this…?
This issue is still not fixed yet!!
Is there any solution for this?
Howdy, still not fixed
same problem
Same problem on Nx monorepo with node v19.7.0
Another passer-by surprised by this bug. Was looking for a small Node static web server to run a static site so I can Playwright tests against it during development/CI. This project seems to fit the bill, but this warning is unfortunate.
same problem.
Same here
Same with node v18.15.0 :(