webpack: opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]
Bug report
Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:133:10) at module.exports (E:\full stack web dev\React Project\my-app\node_modules\webpack\lib\util\createHash.js:90:53) at NormalModule._initBuildHash (E:\full stack web dev\React Project\my-app\node_modules\webpack\lib\NormalModule.js:401:16) at E:\full stack web dev\React Project\my-app\node_modules\webpack\lib\NormalModule.js:433:10 at E:\full stack web dev\React Project\my-app\node_modules\webpack\lib\NormalModule.js:308:13 at E:\full stack web dev\React Project\my-app\node_modules\loader-runner\lib\LoaderRunner.js:367:11 at E:\full stack web dev\React Project\my-app\node_modules\loader-runner\lib\LoaderRunner.js:233:18 at context.callback (E:\full stack web dev\React Project\my-app\node_modules\loader-runner\lib\LoaderRunner.js:111:13) at E:\full stack web dev\React Project\my-app\node_modules\babel-loader\lib\index.js:51:103 { opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ], library: ‘digital envelope routines’, reason: ‘unsupported’, code: ‘ERR_OSSL_EVP_UNSUPPORTED’ }
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior? npm start should display the page which is being failed
Other relevant information: webpack version: webpack@4.28.3 Node.js version: v18.2.0 Operating System: windows 11 64 bit
Additional tools: React.js
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 56
- Comments: 45 (1 by maintainers)
Commits related to this issue
- PA-000 : fix build of muppets (work-around https://github.com/webpack/webpack/issues/15900) and pin version of nginx image — committed to DNSBelgium/mercator by deleted user 2 years ago
- Fixing build issue with webpack Error: error:0308010C:digital envelope routines::unsupported Suggested fix: https://github.com/webpack/webpack/issues/15900#issuecomment-1373595261 — committed to ChaelCodes/MeetAnotherDay by ChaelCodes 3 months ago
Don’t worry you just add this script in your pakage.json file then your error will be solved. “scripts”: { “start”: “react-scripts --openssl-legacy-provider start”, “build”: “react-scripts --openssl-legacy-provider build”, }
don’t worry update your node js dependencies …
use this it will solve your all problem npm install react-scripts@latest
Have you tried this? “start”: “react-scripts --openssl-legacy-provider start”, “build”: “react-scripts --openssl-legacy-provider build”,
package.json
“scripts”: { “start”: “export SET NODE_OPTIONS=–openssl-legacy-provider && react-scripts start”, “build”: “export SET NODE_OPTIONS=–openssl-legacy-provider && react-scripts build” }
This one was worked for my case, thank you!
Here are two options now -
Try to uninstall Node.js version 17+ and reinstall Node.js version 16+ You can re-install the current LTS Node.js version from their Official site. Or more specific downloads from here;
You can use NVM (Node Version Manager)
Linux and Mac users can use this nvm package link Windows users can use this nvm package link Open a terminal and paste these as described: Linux and macOS (Windows Git Bash)-
export NODE_OPTIONS=–openssl-legacy-provider Windows command prompt-
set NODE_OPTIONS=–openssl-legacy-provider Windows PowerShell-
$env:NODE_OPTIONS = “–openssl-legacy-provider”
pls i also face same problem but im using vue frame-work
Try this “scripts”: { “dev”: “SET NODE_OPTIONS=–openssl-legacy-provider && vite”, “build”: " vite build", “preview”: “visit preview”, “storybook”: “SET NODE_OPTIONS=–openssl-legacy-provider && start-storybook -p 6006”, “build-storybook”: “SET NODE_OPTIONS=–openssl-legacy-provider && build-storybook” },
Ayuda!!! ejecuto el comando: npm run build y me sale esto ya intente las opciones anteriores de modificar el package.json, actualmente este es mi script: “scripts”: { “start”: “nodemon index.js” },
⠹ Building for production…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 (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/NormalModule.js:417:16) at handleParseError (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/NormalModule.js:471:10) at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/NormalModule.js:503:5 at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/NormalModule.js:358:12 at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:373:3 at iterateNormalLoaders (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:214:10) at iterateNormalLoaders (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:221:10) at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:236:3 at runSyncOrAsync (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:130:11) at iterateNormalLoaders (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:232:2) at Array.<anonymous> (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:205:4) at Storage.finished (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16) at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9 ⠸ Building for production…/home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:114 throw e; ^
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 (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/NormalModule.js:417:16) at handleParseError (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/NormalModule.js:471:10) at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/NormalModule.js:503:5 at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/webpack/lib/NormalModule.js:358:12 at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:373:3 at iterateNormalLoaders (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:214:10) at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:186:6 at context.callback (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/cache-loader/dist/index.js:240:7 at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/neo-async/async.js:2830:7 at done (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/neo-async/async.js:2865:11) at /home/anaavila260799/Plataformawebiot/Frontend/node_modules/neo-async/async.js:2818:7 at Array.<anonymous> (/home/anaavila260799/Plataformawebiot/Frontend/node_modules/cache-loader/dist/index.js:229:9) { opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ], library: ‘digital envelope routines’, reason: ‘unsupported’, code: ‘ERR_OSSL_EVP_UNSUPPORTED’ }
Node.js v18.14.1
For node 18.19.0 adding this line to
output
of yourwebpack.config.js
fixes the problem:“scripts”: { “start”: “react-scripts --openssl-legacy-provider start”, “build”: “react-scripts build”, “test”: “react-scripts test”, “eject”: “react-scripts eject” }
Not sure why so many comments are talking about
react-scripts
, Vue, Vite and Storybook when this is the Webpack repo, not the repo for all those other systems. The issue is a Node issue (https://github.com/nodejs/node/issues/40455) rather than a Webpack issue.For Webpack itself… I hit the same issue in one of my apps. These were my scripts:
I just added
NODE_OPTIONS=--openssl-legacy-provider
to thecross-env
call to fix it:You can modify your scripts in the package.json like below, am giving a vue example here but you can borrow an idea to react and other frameworks
“scripts”: { “serve”: “export NODE_OPTIONS=–openssl-legacy-provider && vue-cli-service serve”, “build”: “export NODE_OPTIONS=–openssl-legacy-provider && vue-cli-service build”, “lint”: “export NODE_OPTIONS=–openssl-legacy-provider && vue-cli-service lint” },
Save my life! Tried to use ChatGPT but it failed to answer.
Hi, I have the same problem and it’s frustrating, I’m working with vite and I’m trying to install storybook and run it, but I get the error:
opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ], library: ‘digital envelope routines’, reason: ‘unsupported’, code: ‘ERR_OSSL_EVP_UNSUPPORTED’ }
I tried to solve it by putting the message : --openssl-legacy-provider , in my scripts, but it didn’t work for me. These are my scripts: “scripts”: { “dev”: “vite”, “build”: " vite build", “preview”: “visit preview”, “storybook”: " start-storybook -p 6006", “build-storybook”: “build-storybook” }, please help 😦
pls help me implement this to my code! I dont know how to make it work