03000086:digital envelope routines::initialization error

$ npm run docs:dev

> foolsee@1.0.0 docs:dev
> vuepress dev docs

wait Extracting site metadata...
tip Apply theme @vuepress/theme-default ...
tip Apply plugin container (i.e. "vuepress-plugin-container") ...
tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ...
tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ...
tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ...

● Client █████████████████████████ compiling (0%)


ℹ 「wds」: Project is running at http://0.0.0.0:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /Users/manny/Documents/GitHub/foolsee/docs/.vuepress/public
ℹ 「wds」: 404s will fallback to /index.html
node:internal/crypto/hash:69
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:138:10)
    at module.exports (/Users/manny/Documents/GitHub/foolsee/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/manny/Documents/GitHub/foolsee/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/manny/Documents/GitHub/foolsee/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/manny/Documents/GitHub/foolsee/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/manny/Documents/GitHub/foolsee/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/manny/Documents/GitHub/foolsee/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/manny/Documents/GitHub/foolsee/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/Users/manny/Documents/GitHub/foolsee/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Users/manny/Documents/GitHub/foolsee/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Users/manny/Documents/GitHub/foolsee/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Users/manny/Documents/GitHub/foolsee/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v20.5.0
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

该问题的原因是NodeJSOpenSSL版本不匹配导致,解决方法如下:

$ export NODE_OPTIONS=--openssl-legacy-provider
1