Getting error 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED'
Solution 1
I found this solution https://github.com/webpack/webpack/issues/14532
-
if using bash just run
NODE_OPTIONS=--openssl-legacy-provider
before any command -
adding
NODE_OPTIONS=--openssl-legacy-provider
to package.json"scripts": { "start": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start", "build": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build" },
Edit
In my case, I'm using Nodejs 17.0.1 version and causing this error.
Firstly I'm using this command export NODE_OPTIONS=--openssl-legacy-provider
before any command in GitBash Windows to fix this issue.
But, I think it's not an efficient way, so what I do is :
- Uninstall Nodejs 17.0.1
- Install it again Nodejs 16.13.0 version
- I'm facing error another error when I start the server using "yarn serve" (another of my exiting Vuejs project), I don't remember what is this, but after I run "yarn" and "yarn serve", everything works now as I accept
Solution 2
I just got this error, it seems that you are using Node version 17+. It is not compatible with some webpack stuff yet.
Try using LTS version instead, currently at 16.13.0.
Solution 3
This occurred with a build in a docker image when it was using latest node version 17.4.0.
I was able to fix it by switching it to Node v.14 image.
Solution 4
For MacOS and react-native:
"scripts": {
"start": "NODE_OPTIONS=--openssl-legacy-provider react-native start",
}
Yuza
Updated on July 09, 2022Comments
-
Yuza almost 2 years
I got this error when learning Next.js, using
npx create-next-app
command according to site documentation here https://nextjs.org/docs/api-reference/create-next-app. Everything works until I start the server,Error stack:
$ npm run dev > [email protected] dev > next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at BulkUpdateDecorator.hashFactory (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18) at BulkUpdateDecorator.update (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50) at OriginalSource.updateHash (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264) at NormalModule._initBuildHash (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17) at handleParseResult (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10) at C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4 at processResult (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11) at C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5 Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at BulkUpdateDecorator.hashFactory (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18) at BulkUpdateDecorator.update (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50) at OriginalSource.updateHash (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264) at NormalModule._initBuildHash (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17) at handleParseResult (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10) at C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4 at processResult (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11) at C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5 node:internal/crypto/hash:67 this[kHandle] = new _Hash(algorithm, xofLen); ^ Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at BulkUpdateDecorator.hashFactory (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18) at BulkUpdateDecorator.update (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50) at OriginalSource.updateHash (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264) at NormalModule._initBuildHash (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17) at handleParseResult (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10) at C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4 at processResult (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11) at C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5 { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' } Node.js v17.0.1
package.json :
{ "name": "devto-clone", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "next": "11.1.2", "react": "17.0.2", "react-dom": "17.0.2" }, "devDependencies": { "eslint": "7.32.0", "eslint-config-next": "11.1.2" } }
-
Mavv3006 over 2 yearsDoes not work under Win10. I get the error that the command
export
could not be found or is wrongly typed. -
raphael over 2 yearsWorked for me on Linux. Added the export to my .bashrc for convenience.
-
Ricardo Vargas over 2 yearsThanks for Edit with the last part. Node 16 was the solution for me.
-
Erick Adam about 2 years@RicardoVargas Windows or Linux?
-
Roman Kuznetsov almost 2 yearsWorks for me. Windows 10 NodeJS 17.9.0 Angular 9. On run ng serve: "start": "SET NODE_OPTIONS=--openssl-legacy-provider && ng serve",
-
Ricardo Vargas almost 2 yearsSorry @ErickAdam, I just saw your message right now. I was using macOS.