Resolving “error:0308010C:digital envelope routines::unsupported” in Node.js v19.9.0
The error looks like:
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:140:10)
at module.exports (D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\NormalModule.js:417:16)
at D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\NormalModule.js:452:10
at D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\NormalModule.js:323:13
at D:\Projects\Mini Project\Frontend\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at D:\Projects\Mini Project\Frontend\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (D:\Projects\Mini Project\Frontend\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at D:\Projects\Mini Project\Frontend\node_modules\babel-loader\lib\index.js:59:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v19.9.0
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:140:10)
at module.exports (D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\NormalModule.js:503:5
at D:\Projects\Mini Project\Frontend\node_modules\webpack\lib\NormalModule.js:358:12
at D:\Projects\Mini Project\Frontend\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\Projects\Mini Project\Frontend\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\Projects\Mini Project\Frontend\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
D:\Projects\Mini Project\Frontend\node_modules\react-scripts\scripts\start.js:19
throw err;
^
Cause :
The error message suggests that there is a problem with the initialization of the digital envelope routines in the OpenSSL library. This could be caused by various factors, such as incompatible versions of dependencies, misconfigurations, or issues with the cryptographic functions used in your Angular project.
Solution:
Step 1: Open your “package.json”.
Step2: Search for “Script” :
Step3:Update this “start” and “build” with the following and save:
"start": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
"build": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts build",
Now run the react app using: npm start
Warning ⚠️ : setting NODE_OPTIONS=--openssl-legacy-provider can solve the immediate error, it's important to investigate the root cause and consider more permanent solutions to ensure the security and stability of your application
Tags
Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19)