react启动报错: Error: error:0308010C:digital envelope routines::unsupported at new Hash

标题react启动报错:

Error: 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:\project\data-bi-front\databifrontend\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\project\data-bi-front\databifrontend\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\project\data-bi-front\databifrontend\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\project\data-bi-front\databifrontend\node_modules\webpack\lib\NormalModule.js:503:5
at D:\project\data-bi-front\databifrontend\node_modules\webpack\lib\NormalModule.js:358:12
at D:\project\data-bi-front\databifrontend\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\project\data-bi-front\databifrontend\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\project\data-bi-front\databifrontend\node_modules\loader-runner\lib\LoaderRunner.js:221:10)

原因:Node.js 的版本太高,在 Node.js V17+ 版本中发布的 OpenSSl3.0 对允许算法和密钥大小增加了严格的限制,可能会对生态系统造成影响。

方法一:命令行输入 以下命令执行即可

env:NODE_OPTIONS="–openssl-legacy-provider"

方法二 降级nodejs

你可能感兴趣的:(#,nodejs,react,react.js,javascript,node.js)