How to Fix error:03000086:digital envelope routines::initialization

The error:03000086:digital envelope routines::initialization occurs when there is a problem with initializing the digital envelope routines used in your Node.js application.

How to fix error:03000086:digital envelope routines::initialization

To fix the error:03000086:digital envelope routines::initialization, uninstall Node.js version 17+ and reinstall Node.js version 16+.

Step 1: Install Node.js

There are many ways you can use to install Node.js in your application.

  1. Use the NVM to install Node.js.
  2. Install the current LTS Node.js version from their official site.

Step 2: Open a terminal and hit the following commands

For Linux and MacOS users, hit the following command.

export NODE_OPTIONS=--openssl-legacy-provider

For Windows users, hit the following command.

set NODE_OPTIONS=--openssl-legacy-provider

For Windows PowerShell users,

$env:NODE_OPTIONS = "--openssl-legacy-provider"

This will resolve the error in your Node.js application.

Digital envelope routines are cryptographic functions that encrypt and securely decrypt data.

The envelope routines use symmetric and asymmetric encryption methods to ensure the transmitted data’s confidentiality, integrity, and authenticity.

Using React.js

If you use React application, add these scripts to the package.json file to resolve the error.

"scripts": {
   "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
   "build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"

Using Vue.js

If using a Vue.js application, add these scripts to the package.json file.

"scripts": {
   "serve": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
   "build": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
   "lint": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint"

In this code, –openssl-legacy-provider means you are most certainly running with known insecure SSL, so this might mitigate the symptom, but it presumably doesn’t fix the underlying problem.

If you are still facing the error, then might be a problem with encryption.

Potential cause of the error

  1. Using an incorrect encryption algorithm.
  2. Using the unsupported padding method.
  3. Using the incorrect or missing cryptographic key.
  4. Using unsupported key size.

That’s it for this article.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.