error:0308010C:digital envelope routines::unsupported
运行npm run serve
时候控制台报了以下错误.
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (/Users/meshell/Projects/javascript/lianmeng_h5/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/meshell/Projects/javascript/lianmeng_h5/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/meshell/Projects/javascript/lianmeng_h5/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/meshell/Projects/javascript/lianmeng_h5/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/meshell/Projects/javascript/lianmeng_h5/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/meshell/Projects/javascript/lianmeng_h5/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/meshell/Projects/javascript/lianmeng_h5/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/Users/meshell/Projects/javascript/lianmeng_h5/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/Users/meshell/Projects/javascript/lianmeng_h5/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /Users/meshell/Projects/javascript/lianmeng_h5/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
at /Users/meshell/Projects/javascript/lianmeng_h5/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'
}
经过一翻折腾找到了解决方案.
[root$] export NODE_OPTIONS=--openssl-legacy-provider
[root$] npm run serve