Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node 17.0.1 Gatsby error - digital envelope routines::unsupported - ERR_OSSL_EVP_UNSUPPORTED

Tags:

node.js

gatsby

I am building a Gatsby site. I upgraded Node.js to v17.0.1, and when I run a build, there is an error:

Error: digital envelope routines::unsupported  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' 

If I downgrade it to v16, it works fine, and the build will be successful. How can I fix this?

From googling, this may be a similar issue: Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt #48

like image 254
David Avatar asked Oct 21 '21 16:10

David


People also ask

How to fix digital envelope routine unsupported error in angular?

The problem is because of an issue with webpack. Open your command prompt / terminal and run the following command After executing the command, now you can use ng serve command in your command prompt/ terminal which solves digital envelope routines unsupported error in Angular applications.

How to fix error 0308010c - digital envelope routes unsupported?

All you need to do is add the below line in your DockeFile to resolve the issue. The error:0308010C:digital envelope routines::unsupported occurs with the Node.js version 17 as it’s not the LTS version, and there is a breaking change in the OpenSSL.

Why Node JS 17 is not compatible with Webpack version 4?

This error is because node.js 17 uses OpenSSL3, which has changed code for initialization context of md family (including md4), and this is a breaking change. We can find more details about the OpenSSL3 upgrade over here. The Node JS version 17 is not the LTS (Long Term Support), and it is not compatible with the webpack version 4.

What is err_OSSL_EVP_unsupported error?

If you hit an ERR_OSSL_EVP_UNSUPPORTED error in your application with Node.js 17, it’s likely that your application or a module you’re using is attempting to use an algorithm or key size which is no longer allowed by default with OpenSSL 3.0.


1 Answers

This might help. Add these scripts in the package.json file.

React:

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

or

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

Vue.js:

"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" }, 
like image 84
Rajiv Singh Avatar answered Oct 14 '22 18:10

Rajiv Singh