Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:135:10)
at module.exports (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:471:10)
at E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:503:5
at E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:358:12
at E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at E:\Projects\platform-code\platform-cloud\ruoyi-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
10% building 2/5 modules 3 active ...nt-loader\index.js??ref--13-0!E:\Projects\platform-code\platform-cloud\ruoyi-ui\src\main.jsnode:internal/crypto/hash:67
this[kHandle] = new _Hash(algorithm, xofLen);
主要是因为 nodeJs V17 版本发布了 OpenSSL3.0 对算法和秘钥大小增加了更为严格的限制,nodeJs v17 之前版本没影响,但 V17 和之后版本会出现这个错误。
**方案1:**打开IDEA 终端,直接输入
# Linux & Mac OS:
export NODE_OPTIONS=--openssl-legacy-provider
# Windows:
set NODE_OPTIONS=--openssl-legacy-provider
**方案2:**打开IDEA 终端,直接输入(问题解决)
$env:NODE_OPTIONS="--openssl-legacy-provider"
**方案3:**卸载当前版本,安装合适的版本(node.js)
**方案4:**解决方式(仅限 windows):
在项目中 package.json 的 scripts 中新增 SET NODE_OPTIONS=–openssl-legacy-provider
添加前:
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build"
},
添加后:
"scripts": {
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build"
},