Skip to content

How to fix ‘Error:0308010c:digital envelope routines::unsupported’?

  • by
  • 2 min read

Web development has come a long way from basic HTML and CSS pages and PHP backends. These days we have a lot of web development frameworks to work with and quickly deploy web apps and sites. 

That said, it’s also gotten a lot more complex than simple HTML websites. In this article, we’re looking at the “Error: error:0308010c:digital envelope routines::unsupported” error, its reasons and what you can do to fix the problem. 

Also read: How to fix ‘React-scripts: Command not found’ error?

What causes this error?

The error is caused when trying to run a React project on Nodejs version 17 or above. The error can also trigger if you’re building the project using Docker, as it pulls the latest available version of Node.js by default.

The problem here is Node.js 17’s push to use OpenSSL 3, changing the code required for the initialisation context of the md family. 

How to fix this?

Here are two fixes you can try out.

Enable legacy OpenSSL support

You can circumvent the error by enabling support for legacy OpenSSL versions. There are two ways to do this using either the terminal or changing the package.json file. 

Using the terminal

Use this command if you’re on macOS, Linux, or Windows Git Bash.

export NODE_OPTIONS=--openssl-legacy-provider

If you’re on Windows, use this command instead.

set NODE_OPTIONS=--openssl-legacy-provider

Using the package.json file (recommended)

You can also change the package.json file to let React know that you’re supporting legacy OpenSSL features. Just head over to the file and locate this line.

"start": "react-scripts start"

Change this to

"start": "react-scripts --openssl-legacy-provider start"

By downgrading the Node.js version

Another way to quickly get around the problem is by downgrading to the latest stable release version of Node.js (16.15.1 at the time of writing). Just open a terminal, and run the following command.

nvm install 16.15.1

Now try running the project, and it should build without any errors. Try forcing the LTS version using this command if you’re still getting the error.

nvm use --lts

Also read: How to fix ‘Collect2.exe: error: ld returned 1 exit status’ error?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here:

  • >