【问题标题】:How to fix: (node:12364) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated如何修复:(节点:12364)[DEP0111] DeprecationWarning:不推荐访问 process.binding('http_parser')
【发布时间】:2021-08-02 19:02:22
【问题描述】:

ng serve -o 显示以下错误消息:

- Generating browser application bundles...(node:12364) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created) 

比终端显示:\ Generating browser application bundles (phase: emitting)...

但是浏览器一直打不开,看来VSC是死循环了。

我可以做些什么来解决这个问题?

【问题讨论】:

    标签: node.js angular


    【解决方案1】:

    版本兼容性可能是问题所在。将节点 js 版本从 16.8.0 降级到 14.17.5 解决了我的问题。

    【讨论】:

    • 我认为这不是一个好主意,例如,我在本地有各种项目,其中一些在 Angular 12 上,其中一些是 Angular 10,所以如果我降级node.js,我会错过最新 Angular 版本的一些包
    • 降级似乎不是一个绝对的解决方案。
    • 这可以解决问题。如果您想同时安装多个节点版本,我建议使用节点版本管理器(适用于 Windows 的 nvm)
    【解决方案2】:

    我修复了无限循环。我在 angular.json 中输入了 outputPath 的网络路径。这似乎是不可能的。

    错误消息仍然存在。

    - Generating browser application bundles...(node:12364) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
    (Use `node --trace-deprecation ...` to show where the warning was created) 
    

    【讨论】:

    • 我该如何解决这个问题?你能举个例子吗?
    【解决方案3】:

    这是一个独立的 npm 模块。要在 node 中使用,monkeypatch HTTPParser.,http-parser-js 应该通过 node v6-v11 和 v13 上的猴子补丁来工作。我们找到了一种方法让您为项目做出贡献!看起来 http-parser-js 缺少安全策略。 , 在过去的一个月里,我们没有发现 GitHub 存储库的任何拉取请求活动或问题状态的变化。

     npm install http - parser - js
    

    【讨论】:

    • 不是解决方案。错误依然存在