Node.js v17版本npm run dev 报错opensslErrorStack
Node.js 17版本opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ]报错描述D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui>npm run dev> ruoyi@3.2.0 dev> vue-cli-serv
·
Node.js 17版本opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ]
报错描述
D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui>npm run dev
> ruoyi@3.2.0 dev
> vue-cli-service serve
INFO Starting development server...
10% building 2/5 modules 3 active ...ader\index.js??ref--13-0!D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\src\main.jsError: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:503:5
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:358:12
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
node:internal/crypto/hash:67
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:503:5
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\webpack\lib\NormalModule.js:358:12
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at Array.<anonymous> (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
at D:\workspace\ideaproject\RuoYi-Cloud\ruoyi-ui\node_modules\graceful-fs\graceful-fs.js:123: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'
}
Node.js v17.1.0
解决方法
问题原因是在node.js v17版本中OpenSSL方面做了更新。
解决方法有:
- 1.临时解决,设置环境变量
#windows下
set NODE_OPTIONS=--openssl-legacy-provider
#linux下
export NODE_OPTIONS=--openssl-legacy-provider
- 2.降低node.js的版本不要使用v17的版本
由于没有时间去了解真正的原因,如果有其它好的方案,欢迎评论,谢谢。
更多推荐
已为社区贡献1条内容
所有评论(0)