Fixing the “Error: error:0308010c:digital envelope routines::unsupported” in Node.js
As a developer, encountering errors in your projects is a common occurrence. In this blog post, we will discuss a specific error that has been plaguing developers, particularly those working with Node.js. The error in question is "Error: error:0308010c:digital envelope routines::unsupported"
and, as promised, we will provide you with all the possible ways to fix it. By the end of this post, you should have a clear understanding of what causes this error and how to resolve it. So, let’s get started!
Introduction to the Error: error:0308010c:digital envelope routines::unsupported
This error is often encountered by developers working with Node.js, and it is related to the Node.js crypto module. The error occurs when you try to use a cryptographic algorithm that is not supported by the version of OpenSSL installed on your system. This can be particularly problematic when working with third-party libraries or APIs that require specific cryptographic algorithms.
Understanding the Cause
To fix this error, it is essential to understand its root cause. The error is typically caused by one of the following reasons:
- An outdated or incompatible version of Node.js or OpenSSL is installed on your system.
- The algorithm you are trying to use is not available in the installed OpenSSL version.
- A third-party library or API you are using depends on a specific OpenSSL version or algorithm that is not available on your system.
With these causes in mind, let’s explore the possible solutions to fix this error.
Solution 1: Update Node.js
The first possible solution is to update your Node.js installation to the latest version. This can be done using the following commands:
For Windows users:
npm install -g n
n latest
For macOS and Linux users:
sudo npm install -g n
sudo n latest
After updating Node.js, try running your application again to check if the error has been resolved.
Solution 2: Update OpenSSL
If updating Node.js does not resolve the error, you should try updating OpenSSL to the latest version. This can be done using the package manager for your operating system. For example:
On Ubuntu/Debian:
sudo apt-get update
sudo apt-get upgrade openssl
On CentOS/RHEL:
sudo yum update openssl
On macOS (using Homebrew):
brew update
brew upgrade openssl
After updating OpenSSL, restart your application and check if the error has been resolved.
Solution 3: Rebuild Node.js with the Required Algorithm
If the error persists after updating Node.js and OpenSSL, it may be necessary to rebuild Node.js with the required algorithm. This can be done by following these steps:
Clone the Node.js repository:
git clone https://github.com/nodejs/node.git
cd node
Check out the desired Node.js version:
git checkout
Configure the build with the required algorithm:
./configure --openssl-config=
Build and install Node.js:
make -j4
sudo make install
After rebuilding Node.js with the required algorithm, restart your application and check if the error has been resolved.
Solution 4: Use an Alternative Algorithm
If none of the previous solutions work, you can try using an alternative cryptographic algorithm supported by your installed OpenSSL version. To list the available algorithms, you can use the following command:
openssl list -digest-algorithms
Choose an alternative algorithm from the list and update your application code accordingly.
FAQs
How can I find out which version of OpenSSL is installed on my system?
You can check the installed OpenSSL version by running the following command:
openssl version
How can I check which algorithms are supported by my installed OpenSSL version?
You can list the supported algorithms by running the following command:
openssl list -digest-algorithms
Can I install multiple versions of OpenSSL on my system?
It is generally not recommended to install multiple versions of OpenSSL, as it can cause conflicts and other issues. Instead, try to update your existing OpenSSL installation to the latest version or rebuild Node.js with the required algorithm.
How do I know if a third-party library or API requires a specific OpenSSL version or algorithm?
You should consult the documentation or contact the maintainers of the library or API to determine if it has any specific OpenSSL requirements.
We hope that this blog post has provided you with all the necessary information to fix the “Error: error:0308010c:digital envelope routines::unsupported” error in your Node.js projects. By updating your Node.js and OpenSSL installations, rebuilding Node.js with the required algorithm, or using an alternative algorithm,