如何修复(节点:12388)[DEP0066]弃用警告:Windows中弃用了OutgoingMessage.prototype._headers [英] How to fix (node:12388) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated in windows

查看:403
本文介绍了如何修复(节点:12388)[DEP0066]弃用警告:Windows中弃用了OutgoingMessage.prototype._headers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Node的新手.我已经安装了nosejs版本v12.4.0,npm 6.9.0,http-server 0.11.1和Visual Studio代码.我想用我的http-server打开hello word项目,它是在Visual Studio代码中.但是我收到以下错误

错误

[2019-06-21T05:20:18.280Z]"GET/""Mozilla/5.0(Windows NT 10.0; Win64; x64)AppleWebKit/537.36(KHTML,like Gecko)Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763(节点:11596)[DEP0066]弃用警告:已弃用OutgoingMessage.prototype._headers

我尝试 npm install node-gyp 来解决标题问题,但没有成功.

我也尝试使用其他浏览器,例如.chrome,firefox,但没有成功.

 <!DOCTYPE html>< html>< head></head><身体>< h1>Hello Word</h1></body></html> 

我希望在任何浏览器中都能看到"Hello Word".我正在使用Windows 10.

解决方案

节点版本12取消了OutgoingMessage.prototype._headers,该服务器在http服务器中使用.问题在以下位置列出: https://github.com/http-party/http-server/issues/537

https://nodejs.org/api/deprecations.html#deprecations_typeheading

使用节点12.0.0,我使用http服务器收到相同的错误.切换到10.11.0可以消除错误.

I am new to nodes.I have install nosejs version v12.4.0, npm 6.9.0 , http-server 0.11.1 and visual studio code.I want to open my hello word project with my http-server,it is in Visual studio code. But I receive the below error

ERROR

[2019-06-21T05:20:18.280Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763" (node:11596) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated

I tried npm install node-gyp to fix the header problem but no success.

Also I have try to use different browsers eg. chrome, firefox , explore but no success.

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
        <h1> Hello Word </h1>
    </body>
    </html>

I expected to see "Hello Word" in any of the browsers.I am using windows 10. Kindly assist

解决方案

Node version 12 depracated OutgoingMessage.prototype._headers, which is used in http-server. Issue is listed at: https://github.com/http-party/http-server/issues/537

https://nodejs.org/api/deprecations.html#deprecations_dep0066_outgoingmessage_prototype_headers_outgoingmessage_prototype_headernames

Using node 12.0.0 I get the same error using http-server. Switching to 10.11.0 removes the error.

这篇关于如何修复(节点:12388)[DEP0066]弃用警告:Windows中弃用了OutgoingMessage.prototype._headers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆