DEV Community

Cover image for opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ]
Ann
Ann

Posted on

opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ]

I ran into this error yesterday. My work computer is broken, so I had to clone my project into a new computer.
Finished setting up my new computer with a list of things: git, vscode, nvm, Nodejs 20,... I ran git clone, yarn install then yarn dev waiting for the magic to happen. But no something else came up

opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ]

As a developer, I copied the line above and went on the internet. Started looking. There were a lot of suggestions:

  • Remove your node_modules and run yarn install again. I did, didn't work
  • Checking and switching node versions... wasn't even sure I was on Node20 so I also did, didn't work
  • a guy on Stackoverflow said add this script it might help: set SET NODE_OPTIONS=--openssl-legacy-provider that was surely the right thing to do, but not all to achieve the result that we want. So for me at the time, didn't work

Had to ask my colleague for help, he probably thinks I'm annoying but "Ego is the enemy" so I asked him to help debugging and you know what I missed?

In your vscode's terminal, run: yarn startDev
startDev script in my case is actually:
set NODE_ENV=development && set NODE_OPTIONS=--openssl-legacy-provider && concurrently \"nodemon server.js\"

So in conclusion, what I should have done or will do next time to fix this error is, step by step:

  • Clone the project
  • Yarn install
  • In package.json, add set NODE_OPTIONS=--openssl-legacy-provider
  • Don't forget to add && and spaces after the above script to separate it from other scripts in the same line
  • Should probably add the above script to scripts start, main, startServer, startDev if any.
  • Remember to run yarn startDev to seal the deal. Basically, this is the actual spell.
  • Finally, try running yarn dev to see if it works, because maybe your problem is different from mine and this is another "didn't work" suggestion.

Anyways, I hope you find your solution!
I am a noob, but you don't have to be one!

Top comments (0)