Error: error:0308010c:digital envelope routines::unsupported – Tuts Make

This error is usually caused by an unsupported encryption algorithm or cipher. It is possible that the encryption algorithm or cipher used is not supported by the software or library you are using. You should check the documentation for the software or library to see which encryption algorithms and ciphers are supported.
[ad_1]

When you have node js version 17 and JavaScript. And you are using commands on CLI like Vue-cli-service, Webpack, or create-react-app. At that point, you get the error: ERROR: 0308010C: Digital envelope routine::unsupported.

The error occurs due to changes in Node.js v18 related to the SSL (Secure Socket Layer) provider and the default support for OpenSSL version 3. These changes resulted in breaking compatibility with SSL packages in NPM.

Previously, tools like Webpack used the “Md4” hashing algorithm to create file hashes for tracking changes in JavaScript files. However, with the upgrade to Node.js v18, OpenSSL 3.0 moved the “MD4” algorithm into the legacy provider.

In Node.js v17, the default configuration of OpenSSL v3.0 does not load or enable the “MD4” hashing algorithm. Consequently, if you attempt to build your JavaScript application (such as Angular, Vue, or React) after upgrading to Node.js v18, you will encounter this error.

To resolve the error, you can consider the following solutions mentioned earlier:

  1. Upgrade Webpack or the relevant tools to a version that supports the changes in Node.js v17.
  2. Use the –openssl-legacy-provider flag when starting the Node.js server to enable the legacy provider and support the “MD4” algorithm temporarily.

In this tutorial, you will find various solutions to fix error:0308010c:digital envelope routines::unsupported.

How to fix error:0308010C:digital envelope routines

By using the following solutions, you can easily error: error:0308010c:digital envelope routines::unsupported:

  • Solution 1: Update all npm packages in your app

  • Solution 2: Upgrade to Webpack 5 (Latest Version)
  • Solution 3: Add –openssl-legacy-provider flag to your build script
  • Solution 4: Upgrade your react-scripts to version 5
  • Solution 5: Use Latest LTS version of Node.js
  • Solution 6: Downgrade to an older version: Node.js V16

Solution 1: Update all npm packages in your app

Using this solution, you need to update all the npm packages in your app to fix error:0308010C:digital envelope routines::unsupported.

So, open your terminal or command prompt and execute the following command into it to upgrade the npm packages:

npm upgrade

If still not fixed this error, you can execute the following command on terminal or command prompt:

npm audit fix --force

Solution 2: Upgrade to Webpack 5 (Latest Version)

Still, if you are using an older version of Webpack (example Webpack v4) then you need to upgrade your Webpack version to v5.61.0.

So, open your terminal or command prompt and execute the following command into it to install the latest version of Webpack:

npm install [email protected]

Note: Please be aware that this solution may not work if you are using create-react-app or vue-cli to create your JavaScript application. For those specific frameworks, please follow the alternative solution provided below.

Solution 3: Add –openssl-legacy-provider flag to your build script

In this solution, you can add the --openssl-legacy-provider flag to the build script defined in package.json.

The OpenSSL legacy provider is a set of outdated algorithms that are no longer commonly used, including MD2, MD4, MDC2, and others.

To fix this error, you need to add the flag to your build script to enable the “md4” or any other legacy algorithm.

For react js

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

For vue js

{
  "scripts": {
    "serve": "vue-cli-service serve --openssl-legacy-provider"
  },
}

If you encounter an error message stating “Error: Unknown argument: openssl-legacy-provider,” you can resolve it by setting the NODE_OPTIONS environment variable before running the build command. Follow the steps below to apply this change:

Open your command prompt or terminal. Set the NODE_OPTIONS environment variable by running the appropriate command based on your operating system:

For Windows:

set NODE_OPTIONS=--openssl-legacy-provider

For Mac:

export NODE_OPTIONS=--openssl-legacy-provider

After setting the environment variable, run the build command for your project. The build command may vary depending on your specific project setup. Here’s an example using the React build command:

npm run build

Solution 4: Upgrade react-scripts to v5

To resolve this error, you can upgrade the react-scripts package to version 5 if you are using Create React App. Please follow the instructions below:

Open your command prompt or terminal and execute the following command into it to resolve it:

# For npm:
npm install [email protected]

# For Yarn:
yarn add [email protected]

Once the execution is complete, you should be able to run the npm start or yarn start command without encountering the error.

Solution 5: Use Latest LTS version of Node.js

To address the issue, it is recommended to use the LTS (Long-Term Support) version of Node.js. If you are encountering the “error:0308010C:digital envelope routines::unsupported” error, you can try the following troubleshooting steps:

Step 1: Update npm and Node.js Certificate Authority (CA) Certificates

Update npm to the latest version by running the command:

npm install -g [email protected]

Update Node.js Certificate Authority (CA) certificates by running the command:

npm install -g update-ca-certificates

Step 2: Clear npm cache

Clear the npm cache by running the command:

npm cache clean --force

Step 3: Reinstall the affected package

Remove the package causing the error. Replace your-package-name with the actual name of the package. For example:

npm uninstall your-package-name
npm install your-package-name

These troubleshooting steps can help resolve the “error:0308010C:digital envelope routines::unsupported” error. If the issue persists, you may consider seeking further assistance on platforms like consulting the package’s documentation or support channels for specific guidance related to that package.

Solution 6: Downgrade to an older version: Node.js V16

If none of the previously mentioned solutions resolved the error, you can try downgrading Node.js to version 16 as a last option. If you are using nvm (Node Version Manager), follow the below-given instructions:

Open your command prompt or terminal and execute the following command into it to resolve it:

# Install version 16 LTS version
nvm install 16.20.0

# use Node 16.20.0

nvm use 16.20.0

Next, follow these steps to resolve the error:

  1. Open your command prompt or terminal.
  2. Navigate to the root directory of your project.
  3. Delete the node_modules folder by running the command:
  4. Delete the package-lock.json file by running the command:
  5. Now, re-install all your npm packages by running the command:
  6. Once the installation is complete, you can rebuild your application if necessary.
  7. Finally, run the npm start command to start your application, and the error should be resolved.

Conclusion

That’s all, you’ve got 6 solutions to solve the error: 0308010C: Digital envelope routine :: unsupported.

Recommended Tutorials

[ad_2]

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

GSTIN is 03EGRPS4248R1ZD.

Contact
Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00