Skip to content

Fix: Error:03000086:digital envelope routines::initialization error

  • by
  • 2 min read

As easy as Node.js to learn and use, it can be problematic at times, especially when dealing with algorithms and key size. The occasional bug and glitch out of the blue is nothing new for seasoned developers but the error codes can be rather confusing at times. 

In this article, we’re talking about the Error:03000086:digital envelope routines::initialization error, its causes and what can you do to fix the problem.


What causes the Error:03000086:digital envelope routines::initialization error?

The error is often triggered when using an incorrect encryption algorithm. However, other common factors include:

  • Using an unsupported padding method.
  • Unsupported key size. 
  • Using a missing or incorrect cryptographic key.
This is an image of close up code coding 1089440

Also read: Error obtaining VCS status: Exit status 128: Quick Fix


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

Here are three fixes you can try out.

Use legacy OpenSSL

The first and probably the easiest fix to the problem is to enable the openssl-legacy-provider flag to enable legacy algorithms and key sizes. To do so, use the flag in the start NPM script as follows.

NODE_OPTIONS=--openssl-legacy-provider npm run start

If you’re on Windows, use this instead.

set NODE_OPTIONS=--openssl-legacy-provider && npm run start

Finally, if you’re using React, update the start and build scripts in the package.json file.

"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build"

Update Webpack

If updating packages didn’t work, a Webpack update might also be in order. First up, run the following command to check your existing Webpack version.

webpack --version

If the version is 4 or below, we need to update Webpack by running the following command

npm install webpack-cli@5.61.1
What is metadata? Types and benefits | candid. Technology
Photo by Shahadat Shemul

Note that we’re using Webpack version 5.61.1. You can change this to whatever version is the latest at the time of the update. 


Update Node.js

Finally, updating Node.js itself can also resolve the issue. To do so, simply download and install the latest Node.js LTS version from the official website and you should be good to go. 

Also read: How to fix error in ./src/reportWebVitals.js: Can’t resolve ‘web-vitals’?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: yadullahabidi@pm.me.

>