Vuepress项目编译时报routines的错误
文章发布较早,内容可能过时,阅读注意甄别。
我的项目 HowToStartOpenSource (opens new window) 是基于 GitHub Action 进行管理的,代码提交之后会自动编译发布。
今天突然编译总是失败,报错信息如下:
/home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/loader-runner/lib/LoaderRunner.js:114
throw e;
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/webpack/lib/NormalModule.js:471:10)
at /home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/webpack/lib/NormalModule.js:503:5
at /home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/webpack/lib/NormalModule.js:358:12
at /home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at context.callback (/home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/cache-loader/dist/index.js:134:7
at /home/runner/work/HowToStartOpenSource/HowToStartOpenSource/node_modules/graceful-fs/graceful-fs.js:61:14
at FSReqCallback.oncomplete (node:fs:197:23) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
后来检索到一个原因,说是 webpack 的版本原因,具体信息看这个 issue。 (opens new window)
解决方案为,在编译命令中,添加 NODE_OPTIONS
进行解决。
export NODE_OPTIONS=--openssl-legacy-provider
1
上次更新: 2024/11/19, 23:11:42