What is --openssl-legacy-provider in NPM?

10,686

Due to changes on Node.js v17, --openssl-legacy-provider was added for handling key size on OpenSSL v3. You somehow have installed the latest version of node.

  1. Restore your previous version of nodejs.
  2. Go and manually remove the node dependency(e.g. "node":17.4.3) from package.json and packagelock.json.
  3. Delete node_modules folder and use npm install to reinstall node_modules.
Share:
10,686

Related videos on Youtube

Meet Shah
Author by

Meet Shah

Hey, I am a self-taught Java and Web developer. I have knowledge of Java, HTML, CSS and JavaScript. I know JavaFX and Swing Java GUI frameworks

Updated on June 04, 2022

Comments

  • Meet Shah
    Meet Shah over 1 year

    I was building a simple React app using Tailwind. I used create-react-app and then installed tailwind. I have done this many times before.

    In order to install Tailwind, I also had to install craco and change package.json "scripts" to use craco, like so:

    "scripts": {
        "start": "craco start",
        "build": "craco build",
        "test": "craco test",
        "eject": "react-scripts eject"
      }
    

    However, this time, when I ran npm start, I got an error that I had never encountered before:

    Error: error:0308010C:digital envelope routines::unsupported
    

    So I searched on StackOverflow and someone suggested adding --openssl-legacy-provider to my "start" script like this:

    "scripts": {
        "start": "craco --openssl-legacy-provider start",
        "build": "craco build",
        "test": "craco test",
        "eject": "react-scripts eject"
      }
    

    And it's working now. But can somebody please explain to me what --openssl-legacy-provider actually is and how it works?

    • CherryDT
      CherryDT almost 2 years
    • Meet Shah
      Meet Shah almost 2 years
      But why did it happen this time only and not usually? Do I have to do the same for all my projects in future?
    • Thomas Sablik
      Thomas Sablik almost 2 years
      "But why did it happen this time only and not usually?" Because some module uses commands that aren't supported anymore. "Do I have to do the same for all my projects in future?" Only when you use modules that use unsupported commands. I don't know why this commands aren't supported anymore and if it is related to security but using unsupported commands should be a red flag.
    • Meet Shah
      Meet Shah almost 2 years
      Oh. Thanks a lot.