You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular升级Node至v19.0后出现Http_parser废弃警告求助

Node v19升级后Angular开发服务器报错的解决办法

报错内容

(node:5512) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use node --trace-deprecation ... to show where the warning was created)
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
10% building 4/5 modules 1 active ...t\index.js?http://0.0.0.0:0/sockjs-nodenode:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);

解决步骤

1. 处理DEP0111弃用警告

该警告源于旧版SockJS依赖调用了Node v19已弃用的process.binding('http_parser')接口,核心是Angular CLI版本与Node v19不兼容:

  • 优先升级Angular CLI到适配Node v19的稳定版本(建议Angular 14及以上):
    ng update @angular/cli @angular/core
    
  • 若暂时无法升级Angular,可在启动时直接忽略警告:
    ng serve --no-warnings
    

2. 修复crypto/hash初始化错误

这个错误是Node v19加密模块API变更导致,多由项目依赖的旧包(如webpack、SockJS)未适配新版本引起:

  • 清除依赖缓存后重新安装:
    rm -rf node_modules package-lock.json
    npm install
    
  • 升级SockJS客户端到最新兼容版本:
    npm install sockjs-client@latest
    
  • 若上述方法无效,建议降级Node到LTS版本(如v18.x),非LTS版本的Node兼容性较差,更适合生产验证而非开发环境。

内容的提问来源于stack exchange,提问作者Muhammad Arham

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 22:25:21