DevOps | Cloud | Analytics | Open Source | Programming





How To Fix Error - "Digital Envelope Routines::Unsupported" in Node.js or React ?



In this post, we will see How To Fix Error - "Digital Envelope Routines::Unsupported" in Node.js, React.js, Angular.js, Vue.js, Docker etc. Various facets of the error -


Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)


Error: digital envelope routines::unsupported
opensslErrorStack: \[ 'error:03000086:digital envelope routines::initialization error' \],
library: 'digital envelope routines',


Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)


Error: digital envelope routines::unsupported
opensslErrorStack: \[ 'error:03000086:digital envelope routines::initialization error' \],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR\_OSSL\_EVP\_UNSUPPORTED'

The common reason for such issue is Version conflict issue or Version not in-sync with other entities in the system. Sometimes using latest Node.js might throw such error. Lot of projects still depend on Webpack 4 but the latest Node.js might not be compatible with that. Majorly this is caused by the latest Node.js Version compatible issues with OpenSSL.   Check you node version


node -v

  We will try out the below two options to see if that helps to fix the issue.  

Option 1:

If you want to stick to your existing Node.js without down-grading it, then try the below steps -  

  • Use openssl-legacy-provider by setting it as an environment variable

    • Windows - Set below as environment variable

set NODE\_OPTIONS=--openssl-legacy-provider

    • Mac\Linux - Set below in ~/.bash_profile or ~/.bashrc so that it stays even after you logout\login back.

export NODE\_OPTIONS=--openssl-legacy-provider

    • For Docker - add the Highlighted bit in Dockekrfile

ENV NODE\_OPTIONS=--openssl-legacy-provider

OR


RUN export NODE\_OPTIONS=--openssl-legacy-provider && yarn build && yarn install

 

  • The openssl-legacy-provider parameter should be placed inside your package.json. Add the part highlighted in Red.

    • For Angular, use the below and then use npm start

"start": "set NODE\_OPTIONS=--openssl-legacy-provider && ng serve -o"

    • For React, use the below in the package.json file.

"scripts": {
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",
}

OR


"scripts": {
"start": "export SET NODE\_OPTIONS=--openssl-legacy-provider && react-scripts start",
"build": "export SET NODE\_OPTIONS=--openssl-legacy-provider && react-scripts build"
}

  • For Vue.js, use the below in the package.json file.

"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"
},

OR


"scripts": {
"serve": "vue-cli-service --openssl-legacy-provider serve",
"build": "vue-cli-service --openssl-legacy-provider build",
"lint": "vue-cli-service --openssl-legacy-provider lint"
},

  • Also add something like the below Highlighted -

 "scripts": {

       "build": "NODE\_OPTIONS=--openssl-legacy-provider npm run build:your-app:testing”,
       "build:your-app:testing": "NODE\_OPTIONS=--openssl-legacy-provider ng build your-app 
                        --deploy-url https://your-app.com/ --configuration=test-config"

Another example -


"scripts": {
    "dev": "NODE\_OPTIONS=--openssl-legacy-provider nuxt"
}

   

Option 2:

At this point, I am assuming Option 1 somehow did not work out to fix the issue. The next option we can try is to roll-back to an older version of Node.js (STABLE) which is compatible with Webpack and doesn't render this issue.

  • The version that you are using might not be compatible with some Webpack components.
 

  • Remove the current Node.js version and go-back i.e. Downgrade to an older Stable version. e.g. From Node.js 17+ go back to Node.js version 16+.
    • Windows - Uninstall node from the "Add or remove programs". Alternatively use https://docs.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-windows to setup nvm and control Node version through it

nvm use <version>

    • Linux\Mac -

sudo n lts <------ To demote to the last LTS

OR


$ npm install -g n
$ n <VERSION\_NO>

 

  • Once done, cross check if node version is downgraded

$ node -v

 

  •  Delete the folder "node_modules" .
 

  • Re-install Node.js
    • Re-install the latest LTS node.js version from - https://nodejs.org/en/download/releases/
    • Alternatively use NVM package -
      • Linux\Mac - https://github.com/nvm-sh/nvm
      • Windows - https://github.com/coreybutler/nvm-windows

nvm instal lts

OR


nvm use lts

 

  • Rebuild your project.
  Hope this helps to solve the error.    

Other Interesting Reads -

   


 error:0308010c:digital envelope routines::unsupported vue ,failed to construct transformer: error: error:0308010c:digital envelope routines::unsupported ,library: 'digital envelope routines', reason: 'unsupported', code: 'err\_ossl\_evp\_unsupported' ,ganache cli digital envelope routines::unsupported ,opensslerrorstack: \[ 'error:03000086:digital envelope routines::initialization error' \], ,error hh604: error running json-rpc server: error:0308010c:digital envelope routines::unsupported ,openssl digital envelope routines:inner\_evp\_generic\_fetch:unsupported ,openssl error digital envelope routines ,digital envelope routines::unsupported angular ,error:0308010c:digital envelope routines::unsupported vue ,failed to construct transformer: error: error:0308010c:digital envelope routines::unsupported ,library: 'digital envelope routines', reason: 'unsupported', code: 'err\_ossl\_evp\_unsupported' ,opensslerrorstack: \[ 'error:03000086:digital envelope routines::initialization error' \], ,openssl digital envelope routines:inner\_evp\_generic\_fetch:unsupported ,this\[khandle\] = new \_hash(algorithm, xoflen); , , ,library 'digital envelope routines' ,library 'digital envelope routines' reason 'unsupported' code 'err\_ossl\_evp\_unsupported' ,ng serve digital envelope routines unsupported ,node digital envelope routines ,node js digital envelope routines ,nodejs digital envelope routines unsupported ,npm digital envelope routines ,npm digital envelope routines unsupported ,npm run build digital envelope routines unsupported ,ntlm digital envelope routines evp\_digestinit\_ex disabled for fips ,openssl bad decrypt digital envelope routines ,openssl digital envelope routines evp\_decryptfinal\_ex bad decrypt ,digital envelope routines unsupported ,digital envelope routines ,digital envelope routines unsupported angular ,digital envelope routines initialization error ,digital envelope routines' reason 'unsupported' ,digital envelope routines evp\_decryptfinal\_ex bad decrypt ,digital envelope routines evp\_digestinit\_ex disabled for fips ,digital envelope routines unsupported webpack ,digital envelope routines err\_ossl\_evp\_unsupported ,openssl digital envelope routines unsupported ,openssl error outputting keys and certificates digital envelope routines ,openssl error stack digital envelope routines ,openssl unable to load private key digital envelope routines ,paramiko valueerror digital envelope routines evp\_digestinit\_ex disabled for fips ,penpal envelope ideas ,python digital envelope routines evp\_digestinit\_ex disabled for fips ,python valueerror digital envelope routines evp\_digestinit\_ex disabled for fips ,react digital envelope routines unsupported ,storybook digital envelope routines unsupported ,unable to load private key digital envelope routines ,unsupported digital envelope routines ,valueerror digital envelope routines evp\_digestinit\_ex disabled for fips ,vue digital envelope routines unsupported ,webpack digital envelope routines unsupported ,what is digital envelope ,what is the envelope method ,yarn digital envelope routines unsupported ,yarn start digital envelope routines unsupported ,advantages of digital envelope ,angular digital envelope routines unsupported ,ansible digital envelope routines evp\_digestinit\_ex disabled for fips ,bad decrypt digital envelope routines ,config error digital envelope routines evp\_digestinit\_ex disabled for fips ,digital envelope routines ,digital envelope routines angular ,digital envelope routines bad decrypt ,digital envelope routines disabled for fips ,digital envelope routines err\_ossl\_evp\_unsupported ,digital envelope routines error ,digital envelope routines evp decrypt final bad decrypt ,digital envelope routines evp\_decryptfinal\_ex bad decrypt ,digital envelope routines evp\_decryptfinal\_ex bad decrypt teraterm ,digital envelope routines evp\_decryptfinal\_ex wrong final block length ,digital envelope routines evp\_digestinit\_ex disabled for fips ,digital envelope routines evp\_digestinit\_ex disabled for fips paramiko ,digital envelope routines evp\_pkey ,digital envelope routines initialization error ,digital envelope routines initialization error angular ,digital envelope routines inner\_evp\_generic\_fetch ,digital envelope routines meaning ,digital envelope routines node js ,digital envelope routines not supported ,digital envelope routines openssl ,digital envelope routines questions ,digital envelope routines questions and answers ,digital envelope routines questions and answers pdf ,digital envelope routines quora ,digital envelope routines quotes ,digital envelope routines unsupported ,digital envelope routines unsupported angular ,digital envelope routines unsupported at new hash ,digital envelope routines unsupported err\_ossl\_evp\_unsupported ,digital envelope routines unsupported in angular ,digital envelope routines unsupported nextjs ,digital envelope routines unsupported react ,digital envelope routines unsupported vue ,digital envelope routines unsupported webpack ,digital envelope routines unsupported windows ,digital envelope routines wrong final block length ,digital envelope routines xerox ,digital envelope routines xls ,digital envelope routines xlsx ,digital envelope routines xpath ,digital envelope routines zerodha ,digital envelope routines zerodha kite ,digital envelope routines zoho ,digital envelope routines zomato ,digital envelope routines' ,digital envelope routines' reason 'unsupported' ,digital envelope routines' reason 'unsupported' code 'err\_ossl\_evp\_unsupported' ,digital organizer job description ,digital organizing ideas ,digital photo organization ideas ,digital transformation activities ,docker digital envelope routines unsupported ,err\_ossl\_evp\_unsupported digital envelope routines ,error digital envelope routines evp\_decryptfinal ,error digital envelope routines unsupported ,failed to construct transformer digital envelope routines ,how to create digital envelope ,ideas for cash envelope system ,j&t envelope size ,