skip to Main Content

This problem appeared after an update sudo apt upgrade on Ubuntu 20.04.
Previously, I worked on versions node v18.0.0 and npm 8.7.0, but after the update there was a problem, I ran command nvm install node --reinstall-packages-from=node, but it did not help.
Now I use npm v8.12.1, node v18.4.0.
When running the command npm start I recieve the message :

> [email protected] start
> cross-env PORT=10888 HTTPS=false react-scripts start --openssl-legacy-provider

node: --openssl-legacy-provider is not allowed in NODE_OPTIONS

part of a file package.json looks like this :

 "scripts": {
    "start": "cross-env PORT=10888 HTTPS=false react-scripts start --openssl-legacy-provider",
    "build": "react-scripts build",
    "predeploy": "npm run build",
    "deploy": "vk-miniapps-deploy",
    "tunnel": "vk-tunnel --insecure=1 --http-protocol=https --ws-protocol=wss --host=localhost --port=10888"
  },

I went back to version npm 8.7.0, npm install -g [email protected] but now even the output of node version shows the same error :

node -v
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS

attempt to update :

nvm install 12.13.0
v12.13.0 is already installed.
Now using node v12.13.0 (npm v)

10

Answers


  1. You can try to perform an unset on the NODE_OPTIONS production variable. It can be done from the command line.

    Your Node version seems already up-to-date (version 18). A similar problem was already treated and solved according to the following Github link:
    https://github.com/microsoft/vscode/issues/136599

    Login or Signup to reply.
  2. On Linux, you need to edit your /etc/ssl/openssl.cnf to un-comment a few lines that will enable legacy provider support.

    I am on Fedora 36; I had to change these lines:

    ##[provider_sect]
    ##default = default_sect
    ##legacy = legacy_sect
    ##
    ##[default_sect]
    ##activate = 1
    ##
    ##[legacy_sect]
    ##activate = 1
    

    to:

    [provider_sect]
    default = default_sect
    legacy = legacy_sect
    
    [default_sect]
    activate = 1
    
    [legacy_sect]
    activate = 1
    
    Login or Signup to reply.
  3. I installed a new version but not did use

    nvm use node
    
    Login or Signup to reply.
  4. I ran into this on MacOS. From terminal, I ran export to check my environment variables and saw that NODE_OPTIONS=--openssl-legacy-provider had been set. I then simply ran unset NODE_OPTIONS and then was able to use node again.

    Login or Signup to reply.
  5. Just Run this command

    unset NODE_OPTIONS
    
    Login or Signup to reply.
  6. For me unsetting NODE_OPTIONS alone didn’t solve the problem, had to use

    nvm use v18 
    

    to solve the issue

    Login or Signup to reply.
  7. I’m running macOS. I previously had Node Version 18, which had this issue in my NodeJs Project

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

    I downgraded the Node Version to 16 LTS, and then it had this error

    node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
    

    The issue resolved by simply running the following command in the terminal.

    unset NODE_OPTIONS
    

    Hope this helps! 🙂

    Login or Signup to reply.
  8. update NVM to v18,

    then unset NODE_OPTIONS

    WILL BE OK!

    Login or Signup to reply.
  9. The above were good suggestions. However, what worked for me was commenting the entry in the .npmrc file located in my project folder as shown here

    Login or Signup to reply.
  10. Two ways to fix it-

    WAY 1

    Try reseting NODE_OPTIONS by running following command

    export NODE_OPTIONS=""
    

    WAY 2

    Upgrade to Node 18

    nvm use v18
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search