error:0308010C:digital envelope routines::unsupported
出現(xiàn)這個(gè)錯(cuò)誤是因?yàn)?node.js V17版本中最近發(fā)布的OpenSSL3.0, 而OpenSSL3.0對(duì)允許算法和密鑰大小增加了嚴(yán)格的限制城豁,可能會(huì)對(duì)生態(tài)系統(tǒng)造成一些影響.
在node.js V17以前一些可以正常運(yùn)行的的應(yīng)用程序,但是在 V17 版本可能會(huì)拋出以下異常:
node:internal/crypto/hash:67this[kHandle]=new_Hash(algorithm,xofLen);^Error:error:0308010C:digitalenvelope routines::unsupported atnewHash(node:internal/crypto/hash:67:19)atObject.createHash(node:crypto:130:10)atmodule.exports.__webpack_modules__.57442.module.exports(/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:135907:62)atNormalModule._initBuildHash(/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109317:16)at handleParseError(/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109371:10)at/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109403:5at/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:109258:12at/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:61157:3at iterateNormalLoaders(/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:60998:10)atArray.<anonymous>(/Users/workspace/React/umiapp/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:60989:4){opensslErrorStack:['error:03000086:digital envelope routines::initialization error'],library:'digital envelope routines',reason:'unsupported',code:'ERR_OSSL_EVP_UNSUPPORTED'}Node.js v17.0.1?Donein1.92s.
目前可以通過(guò)運(yùn)行以下命令行臨時(shí)解決這個(gè)問(wèn)題
Linux & Mac OS (windows git bash)
export NODE_OPTIONS=--openssl-legacy-provider
windows命令提示符:
set NODE_OPTIONS=--openssl-legacy-provider