close

[Solved] Error: error:0308010C:digital envelope routines::unsupported

I am just trying to run my newly created reactjs project but I am facing the following error: Error: error:0308010C:digital envelope routines::unsupported. In this Exerror article, We are going to learn about How to reproduce this error and we will discuss All Possible Solutions Let’s Get Start With This Article.

How Error: error:0308010C:digital envelope routines::unsupported Occurs?

I am just trying to run my newly created reactjs project but I am facing the following error.

Error: error:0308010C:digital envelope routines::unsupported

So here I am writing all the possible solutions that I have tried to resolve this error.

How To Solve Error: error:0308010C:digital envelope routines::unsupported?

  1. How To Solve Error: error:0308010C:digital envelope routines::unsupported?

    To Solve Error: error:0308010C:digital envelope routines::unsupported You can also set NODE_OPTIONS globally and that will resolve this error. First of all, open your terminal and run this command in your windows system: set NODE_OPTIONS=–openssl-legacy-provider If You are using Windows Git Bash, Linux or macOS then You need to run this command: export NODE_OPTIONS=–openssl-legacy-provider If You Dont have NODE_OPTIONS setup in your system then you can also set the NODE_OPTIONS environment variable right before issuing the command for a particular project. You just need to change below line in your package.json file: “dev”: “NODE_OPTIONS=–openssl-legacy-provider next dev”, “build”: “NODE_OPTIONS=–openssl-legacy-provider next build && next export”, Now, Your error will be solved.

  2. Error: error:0308010C:digital envelope routines::unsupported

    To Solve Error: error:0308010C:digital envelope routines::unsupported You need to set –openssl-legacy-provider flag while running your start script and it will Resolve your Error: error:0308010C:digital envelope routines::unsupported. Open your package.json file and replace this start just like this: “start”: “react-scripts –openssl-legacy-provider start” And now, Your error will be solved. Thank You.

Solution 1: Add this line in your package.json

You need to set –openssl-legacy-provider flag while running your start script and it will Resolve your Error: error:0308010C:digital envelope routines::unsupported. Open your package.json file and replace this start just like this.

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

And now, Your error will be solved. Thank You.

Solution 2: Set NODE_OPTIONS

You can also set NODE_OPTIONS globally and that will resolve this error. First of all, open your terminal and run this command in your windows system.

set NODE_OPTIONS=--openssl-legacy-provider

If You are using Windows Git Bash, Linux or macOS then You need to run this command.

export NODE_OPTIONS=--openssl-legacy-provider

If You Dont have NODE_OPTIONS setup in your system then you can also set the NODE_OPTIONS environment variable right before issuing the command for particular project. You just need to change below line in your package.json file.

{
  "scripts": {
    "dev": "NODE_OPTIONS=--openssl-legacy-provider next dev",
    "build": "NODE_OPTIONS=--openssl-legacy-provider next build && next export",
  }
}

Now, Your error will be solved.

Solution 3: Downgrade node

In The Current LTS Node version which is 16.16.0 LTS this error will not come So That You Just need to use LTS version of Node and your error will be resolved. To do so you just need to Node Version Manager.

Just after NVM is installed in your system you need to run run this command.

nvm install 16.16.0

Or You can run this command

nvm install lts

Both commands will install the LTS version of a node in your system and your error will be solved.

Conclusion

It’s all About this error. I hope We Have solved Your error. Comment below Your thoughts and your queries. Also, Comment below on which solution worked for you.

Also, Read

Leave a Comment