Node 18 报错:Error: error:0308010C:digital envelope routines::unsupported

更新日期: 2025-04-19 阅读次数: 36 字数: 132 分类: nodejs

在新的 WSL Ubuntu 环境下安装 Ant Design Pro 的开发环境(参考:安装搭建 Ant Design Pro V5 开发环境),报错:

node:internal/crypto/hash:69
this[kHandle] = new _Hash(algorithm, xofLen);

Error: error:0308010C:digital envelope routines::unsupported

Node 版本

Node.js v18.19.1

解决方法

在执行 tyarn start:dev 之前,先设置环境变量:

export NODE_OPTIONS=--openssl-legacy-provider

然后再执行其他命令,就可以了。

放到 smug 配置文件中进行管理就更方便了。

Node 版本过高导致

之前没有报错的开发环境 node 版本为 16,但是我又不想降级 node 版本,所以就只能用上面的方法了。

微信关注我哦 👍

大象工具微信公众号

我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式