Article Info: Error: Error:0308010c:Digital Envelope Routines::Unsupported | What are Main Cause of Error:0308010c:Digital Envelope Routines::Unsupported | How to Fix Error:0308010c:Digital Envelope Routines::Unsupported in Detail, Follow all Intructions
If you work with Node.js and command line interface solutions like Webpack, create-react-app, or vue-cli-service, you might have encountered the error, Error: error:0308010c:digital envelope routines::unsupported.
You’re not alone, because I’m currently getting it too:
The React app indeed failed to start:
In this article, you’ll learn how to fix this error in 3 ways. But first, let’s discuss what causes the error.
What Causes the Error:0308010c:Digital Envelope Routines::Unsupported?
You are likely getting this error because of 2 main reasons:
- You’re not using the LTS (long term support) version of Node JS. You can see I’m using Node 17.0.0, which is not an LTS version of Node.
- You’re using react-script with a version less than 5
The error can also occur because you’re using Node 17.
Outdated Software: If the recipient’s device is running outdated software, it may not support the encryption method used in the
digital envelope. This can result in the error message.
Incompatible Software: In some cases, the recipient’s device may be running software that is not compatible with the encryption method used in the digital envelope. This can result in the error message.
Corrupted Data: If the data in the digital envelope is corrupted, it may result in the error message. This can happen during transmission or due to a malfunction in the sender’s device.
How to Fix the Error:0308010c:Digital Envelope Routines::Unsupported ?
There are at least 3 ways by which you can fix this error. We are going to look at them one by one. Any of them should work for you.
Pass --openssl-legacy-provider
to Webpack or the CLI Tool
In a React app, for instance, you can pass —openssl-legacy-provider to the start script like this “react-scripts –openssl-legacy-provider start”.
That should do it. But if this fails to fix the error, then proceed to the next fix. On many occasions, it works.
Use an LTS Version of Node JS
- Consider downgrading your Node version to 16.16.0 or other LTS versions.
- Currently, 18.12.1 is the latest LTS version of Node. You can download it from the Node JS official website or use NVM to install it.
Upgrade React Script to Version 5+
If you’re working with React and this still fails to fix the error for you, then it’s likely an issue with your React script.
- If you’re using a React script version less than 5, then you should upgrade it to version 5+.
- In my case, I’m currently using react-scripts 3.4.3:
To upgrade react-scripts to 5+, you can do it in two ways:
- Uninstall and reinstall react-scripts
- Open the terminal and run npm uninstall react-scripts
- Run npm install react-scripts
- Manually change the react script version
- Go to your package.json and change the react-script version to 5.0.2
- Delete the node_modules folder by running rm –rf node_modules
- Delete the package.lock.json file by running rm –rf package.lock.json
- Run npm install or yarn add, depending on the package manager you’re using.
After upgrading the version of react-scripts to 5+, my React app is now working fine.
Other Methods
How to Fix the Error: Error:0308010C:Digital Envelope Routines::Unsupported Bug?
The easiest way to fix this error from your program is to reinstall the latest Node.JS version and reinstall versions lower than Node.JS 16. For instance, older versions support webpack version 4, which works great when creating complex Node.JS documents, as explained before.
In addition, developers and programmers can install older Node.JS versions from their official website, which is the best place to find an adequate program.
In addition, customers can use the Node.JS Version Manager to downgrade to the latest Node.JS versions, but this requires skill and is not suitable for beginners. Still, having this as a backup is vital in case the primary solution does not work, which is not uncommon for complex documents.
Let us learn more about the possible solutions in the following bullet list:
- Uninstall the latest Node.JS version and install older ones
- Open the terminal and paste adequate functions
- Add the OpenSSL legacy in the package.json function
- Set the OpenSSL legacy provider globally
As you can see, our experts offer four standard solutions to debug the error from your document. Although downgrading your Node.JS version is the best bet, all other methods are full-proof and will erase the error syntax.
So, we will help you understand the required steps to debug the error using examples and thorough explanations.
1. Uninstall the Latest node.JS Version and Install Older Ones
Our experts explained in the previous sections that uninstalling the latest Node.JS version and installing older ones will debug the error. However, the process can sometimes be challenging to less experienced users, especially if this is their first time working with complex Node.JS documents.
Their official website is the ultimate place to find older versions because you will be sure the programs will work and will not cause other issues. Developers can uninstall the program from the manager and use the downloaded file to install older programs.
On the flip side, our experts recommend using the specific Node.JS Version Manager because it has different functions for Windows and Mac OS users.
In addition, the manager helps with debugging due to its tremendous and straightforward user interface with many options. However, both methods will work, so developers should not worry about messing up their documents.
2. Open the Terminal and Paste Adequate Functions
The second solution requires programmers to open the terminal with the essential elements and tags and paste adequate functions. The functions have different inputs for Windows and Mac OS users, so we recommend copying them from our complete guide.
In addition, developers must be aware these legacy providers might affect other functions, so use them adequately.
Linux and Mac OS users should use the following function:
Export NODE_OPTIONS=–openssl-legacy-provider |
This simple syntax improves the Node’s function and adds a different option, essential when debugging the error from your document.
On the flip side, our experts recommend Windows users copy this function:
Set NODE_OPTIONS=–openssl-legacy-provider |
This command prompt looks similar to the previous example, but it will not work for Linux and Mac OS.
In addition, we provide another solution syntax for Windows Power Shell users, as shown in the following example:
$Env:NODE_OPTIONS = “–openssl-legacy-provider” |
Developers and programmers must copy these functions in the terminal to debug the envelope routine error. As a result, your Node.JS document will be bug-free and completely functional without affecting its parent elements and tags.
3. Add the OpenSSL Legacy in the package.json Function
A possible solution exists for customers who do not want to downgrade their Node.JS version and use the latest programs. However, they must locate the package.json function and modify the line, which should not be challenging. As a result, the document will support webpack version 4 and remove the error from your record.
Developers must change the following line from their document:
“start”: “react-scripts start” |
Although this example looks innocent and correct, it can severely affect your programming experience when working with Node.JS programs. So, our experts suggest copying the following code line instead:
“start”: “react-scripts –openssl-legacy-provider start” |
The difference is insignificant, but it is potent because it debugs the error syntax and allows developers to use the latest Node.JS versions. Although this seems counterintuitive to the first solution, our experts believe having a backup is vital when working with complex files.
In addition, this function change will not affect other functions and elements in your document, an excellent outcome for a demanding task. However, we have another ace up in our sleeves to help developers boost their productivity.
4. Set the OpenSSL Legacy Provider Globally
The last method to solve the systematic error from your program requires setting the NODE_OPTIONS function in the document. Although this is not recommended because it can destroy other parts, it is a quick and easy solution. For instance, developers must use the OpenSSL legacy provider on all functions and elements, which will debug and obliterate the error.
Programmers can try the same technique on an advanced Docker build because the program sometimes initiates this error. All Docker builds work on the same principle, so this debugging method will work for all files where the same problem appears.
Use the next line in your Docker file to debug the systematic error:
RUN export NODE_OPTIONS=–openssl-legacy-provider && yarn build && yarn install –production –ignore-scripts –prefer-offline |
As you can tell, these simple code changes are efficient but short, so beginners should not be scared to try and replicate the syntax in their documents. Making a small mistake will not obliterate your Node.JS document and its functions.
Conclusion
Debugging the digital envelope routine error from your document is easy because our experts offer several solutions. First, however, we suggest reading the following bullet list featuring the details before you go, a great way of remembering the facts:
- This standard error affects the latest version Node.JS documents and functions
- The complete error document has different syntaxes and locations after the main message
- Our experts provide four full-proof solutions that do not require much experience and complex operations
- The best way to debug the error is to uninstall the latest Node.JS versions and install older ones using their official website
- Using the latest Node.JS version is possible, but developers must set the OpenSSL legacy provider globally.