116 字
1 分钟
Err Ossl Evp Unsupported
2023-08-22

一个比较老的Vue项目,在启动时候,报错:

Terminal window
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'

问题原因是nodejs升级到17后,openssl3.0 对允许算法密钥大小增加了严格的限制,临时的解决办法是配置node_options.

Terminal window
# Windows 环境
$env:NODE_OPTIONS="--openssl-legacy-provider"
#or
set NODE_OPTIONS=--openssl-legacy-provider
# Linux or Mac
export NODE_OPTIONS=--openssl-legacy-provider

上述的方法是一次性的,也可以在package.json中对script进行修改,如

...
"serve" : "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve"
...
Err Ossl Evp Unsupported
https://blog.cuixu.cn/posts/node/err-ossl-evp-unsupported/
作者
崔旭
发布于
2023-08-22
许可协议
CC BY-NC-SA 4.0