当前位置:首页 » 《关于电脑》 » 正文

错误解决Error: error:0308010C:digital envelope routines::unsupported

2 人参与  2024年04月03日 10:05  分类 : 《关于电脑》  评论

点击全文阅读


前端项目npm run serve报错,

rror: 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 (D:\company_project\map-edit2\font\node_modules\webpack\lib\util\createHash.js:135:53)    at NormalModule._initBuildHash (D:\company_project\map-edit2\font\node_modules\webpack\lib\NormalModule.js:417:16)    at handleParseError (D:\company_project\map-edit2\font\node_modules\webpack\lib\NormalModule.js:471:10)    at D:\company_project\map-edit2\font\node_modules\webpack\lib\NormalModule.js:503:5    at D:\company_project\map-edit2\font\node_modules\webpack\lib\NormalModule.js:358:12    at D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:373:3    at iterateNormalLoaders (D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:214:10)    at iterateNormalLoaders (D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:221:10)    at D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:236:3    at runSyncOrAsync (D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:130:11)    at iterateNormalLoaders (D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:232:2)    at Array.<anonymous> (D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:205:4)    at Storage.finished (D:\company_project\map-edit2\font\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)    at D:\company_project\map-edit2\font\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9node:internal/crypto/hash:71  this[kHandle] = new _Hash(algorithm, xofLen);                  ^Error: error:0308010C:digital envelope routines::unsupported    at module.exports (D:\company_project\map-edit2\font\node_modules\webpack\lib\util\createHash.js:135:53)    at NormalModule._initBuildHash (D:\company_project\map-edit2\font\node_modules\webpack\lib\NormalModule.js:417:16)    at handleParseError (D:\company_project\map-edit2\font\node_modules\webpack\lib\NormalModule.js:471:10)    at D:\company_project\map-edit2\font\node_modules\webpack\lib\NormalModule.js:503:5    at D:\company_project\map-edit2\font\node_modules\webpack\lib\NormalModule.js:358:12    at D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:373:3    at iterateNormalLoaders (D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:214:10)    at Array.<anonymous> (D:\company_project\map-edit2\font\node_modules\loader-runner\lib\LoaderRunner.js:205:4)    at Storage.finished (D:\company_project\map-edit2\font\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)    at D:\company_project\map-edit2\font\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9    at D:\company_project\map-edit2\font\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 v18.12.1

问题原因:

查了下原因,主要是 nodeJs V17 版本发布了 OpenSSL3.0 对算法和秘钥大小增加了更为严格的限制,nodeJs v17 之前版本没影响,但 V17 和之后版本会出现这个错误。 我的node版本是v18.12.1

解决方式(仅 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"

},


点击全文阅读


本文链接:http://zhangshiyu.com/post/89866.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1