报错之 0308010C digital envelope routines unsupported

问题描述

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/tmp/pip-req-build-_z7cnmv2/node_modules/webpack/lib/util/createHash.js:75:53)
at NormalModule._initBuildHash (/tmp/pip-req-build-_z7cnmv2/node_modules/webpack/lib/NormalModule.js:403:16)
at handleParseError (/tmp/pip-req-build-_z7cnmv2/node_modules/webpack/lib/NormalModule.js:451:10)
at /tmp/pip-req-build-_z7cnmv2/node_modules/webpack/lib/NormalModule.js:483:5
at /tmp/pip-req-build-_z7cnmv2/node_modules/webpack/lib/NormalModule.js:344:12
at /tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:370:3
at iterateNormalLoaders (/tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:211:10)
at iterateNormalLoaders (/tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:218:10)
at /tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:233:3
at context.callback (/tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at untouched (/tmp/pip-req-build-_z7cnmv2/node_modules/source-map-loader/index.js:69:3)
at Object.module.exports (/tmp/pip-req-build-_z7cnmv2/node_modules/source-map-loader/index.js:66:10)
at LOADER_EXECUTION (/tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
at runSyncOrAsync (/tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
at iterateNormalLoaders (/tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
at Array.<anonymous> (/tmp/pip-req-build-_z7cnmv2/node_modules/loader-runner/lib/LoaderRunner.js:202:4)
at Storage.finished (/tmp/pip-req-build-_z7cnmv2/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
at /tmp/pip-req-build-_z7cnmv2/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9
at /tmp/pip-req-build-_z7cnmv2/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'

原因分析

  1. node版本高于16,项目的版本不高于16。
  2. 具体错误原因:ERR_OSSL_EVP_UNSUPPORTED 错误SSL 数字信封不支持

解决

1. 修改环境变量 NODE_OPTIONS=--openssl-legacy-provider

Linux 命令

1
export NODE_OPTIONS=--openssl-legacy-provider

不是 setset 是设置 shell 的变量,不是设置环境变量。

1
set NODE_OPTIONS=--openssl-legacy-provider

2. 降级nodejs(有时不能解决)

降级虽然也是可以的,最后可能还是要升级,不推荐

1
2
3
4
nvm install 16.13.0

# or
conda install nodejs=16

或者卸载当前的nodejs 重新下载安装即可。


报错之 0308010C digital envelope routines unsupported
https://flepeng.github.io/021-frontend-nodejs-51-报错-报错之-0308010C-digital-envelope-routines-unsupported/
作者
Lepeng
发布于
2021年8月4日
许可协议