解決前端報(bào)錯(cuò)“opensslErrorStack:?[?'error:03000086:digital?envelope?routines::initialization?error'?]”
報(bào)錯(cuò)“ opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]”
報(bào)錯(cuò)信息
前端啟動(dòng)項(xiàng)目報(bào)錯(cuò),報(bào)錯(cuò)信息如下:
$ yarn start
yarn run v1.22.21
$ cross-env UMI_ENV=dev umi dev
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Bundle with webpack 5...
?? MFSU Enabled
Starting the development server...
* Webpack █████████████████████████ building (10%) 0/2 entries 1/2 dependencies 0/1 modules 1 active
...odules\umi\node_modules\@umijs\preset-built-in\bundled\@pmmmwh\react-refresh-webpack-plugin\client\ReactRefreshEnt
ry.js
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:133:10)
at BulkUpdateDecorator.hashFactory (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:184161:18)
at BulkUpdateDecorator.update (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:184062:50)
at OriginalSource.updateHash (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack-sources2\index.js:1:51038)
at NormalModule._initBuildHash (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:115961:17)
at handleParseResult (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:116027:10)
at D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:116119:4
at processResult (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:115836:11)
at D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:115900:5
at D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:35132:3
at iterateNormalLoaders (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:34958:10)
at Array.<anonymous> (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:34949:4)
at runCallbacks (D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:24341:15)
at D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:24514:4
at D:\桌面\fastapi-ui-ant-P12\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:33829:16 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.18.0
Done in 17.70s.原因分析
由于Node.js和OpenSSL兼容性問題,您在執(zhí)行yarn start期間遇到了ERR_OSSL_EVP_UNSUPPORTED錯(cuò)誤。這個(gè)錯(cuò)誤通常出現(xiàn)在Node.js 17版本及更高版本中,原因是在OpenSSL 3.0中默認(rèn)禁用了某些加密功能。
解決問題
1. 設(shè)置環(huán)境變量
錯(cuò)誤可以通過設(shè)置一個(gè)環(huán)境變量來解決,這可以告訴Node.js使用OpenSSL 3.0的傳統(tǒng)提供者功能。
在Windows上(命令行):
set NODE_OPTIONS=--openssl-legacy-provider yarn start
在Windows上(Powershell):
$env:NODE_OPTIONS="--openssl-legacy-provider" yarn start
在macOS或Linux上:
export NODE_OPTIONS=--openssl-legacy-provider yarn start
這會(huì)臨時(shí)地為當(dāng)前會(huì)話設(shè)置環(huán)境變量。如果這解決了問題,您可能希望在環(huán)境中永久設(shè)置此更改,或者將其包含在項(xiàng)目啟動(dòng)腳本中。
2. 更新包腳本
或者,您可以通過修改package.json腳本,在運(yùn)行項(xiàng)目時(shí)包含此環(huán)境變量:
"scripts": {
"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider umi dev",
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider umi build"
}3. 升級(jí)或降級(jí)Node.js
如果上述解決方案不可行,考慮更改Node.js版本。早于17版本的Node.js版,或者最新的LTS版本,可能不會(huì)出現(xiàn)這個(gè)問題。
- 對(duì)于生產(chǎn)應(yīng)用程序來說,降級(jí)到LTS版本(如16.x)可能是一個(gè)更穩(wěn)定的解決方案。
- 如果您使用的是早期版本的Node.js,或者更高版本可能仍存在與OpenSSL 3.0相關(guān)的未解決問題,請考慮升級(jí)到最新的LTS版本。
總結(jié)
到此這篇關(guān)于解決前端報(bào)錯(cuò)“opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]”的文章就介紹到這了,更多相關(guān)前端報(bào)錯(cuò)opensslErrorStack error:03000086內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- node.js使用npm 安裝插件時(shí)提示install Error: ENOENT報(bào)錯(cuò)的解決方法
- nodejs npm錯(cuò)誤Error:UNKNOWN:unknown error,mkdir ''D:\Develop\nodejs\node_global''at Error
- nodejs和npm版本不匹配:ERROR:?npm?v9.5.1?is?known?not?to?run?on?Node.js
- 解決nodejs報(bào)錯(cuò)Error:EPERM:operation not permitted,mkdir‘xxxxxxxxxxxxxxxx‘
- 解決hadoop啟動(dòng)報(bào)錯(cuò)ERROR: Attempting to operate on hdfs namenode as root的方法
- 解決node報(bào)錯(cuò)Error: Cannot find module http-errors的問題
- Node.js報(bào)錯(cuò)信息Error:?Cannot?find?module?'XXX'問題及解決
相關(guān)文章
30分鐘用Node.js構(gòu)建一個(gè)API服務(wù)器的步驟詳解
這篇文章主要介紹了30分鐘用Node.js構(gòu)建一個(gè)API服務(wù)器的步驟詳解,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2019-05-05
mongodb初始化并使用node.js實(shí)現(xiàn)mongodb操作封裝方法
這篇文章主要介紹了mongodb初始化并使用node.js實(shí)現(xiàn)mongodb操作封裝方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04
使用node-cron實(shí)現(xiàn)Node.js定時(shí)任務(wù)方式
node-cron是一個(gè)輕量級(jí)的Node.js庫,用于在指定時(shí)間或間隔執(zhí)行任務(wù),它支持Cron表達(dá)式,適用于定時(shí)任務(wù)場景,文章還介紹了基礎(chǔ)用法、高級(jí)功能、實(shí)際應(yīng)用示例以及注意事項(xiàng)2025-10-10
Node.js中使用mongoskin操作mongoDB實(shí)例
這篇文章主要介紹了Node.js中使用mongoskin操作mongoDB實(shí)例,Mongous是一個(gè)輕量級(jí)的nodejs mongodb驅(qū)動(dòng),需要的朋友可以參考下2014-09-09
nodejs調(diào)用rust的完整代碼實(shí)例
Rust主要用在一些需要高性能效果的地方,這篇文章主要介紹了nodejs調(diào)用rust的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下2025-08-08
Node.js匹配文件夾所有文件關(guān)鍵字的完整教程
本文基于nodejs構(gòu)建一個(gè)自動(dòng)化檢測工具:讀取 Excel 中的關(guān)鍵字,在指定目錄的所有文件中搜索是否存在對(duì)應(yīng)內(nèi)容,最終生成帶標(biāo)記結(jié)果的 Excel 文件,需要的朋友可以參考下2025-04-04
使用Node.js配合Nginx實(shí)現(xiàn)高負(fù)載網(wǎng)絡(luò)
這篇文章主要介紹了使用Node.js配合Nginx實(shí)現(xiàn)高負(fù)載網(wǎng)絡(luò),Node的異步加上Nginx的反向代理在性能上實(shí)在是給力!需要的朋友可以參考下2015-06-06

