Reputation: 1115
This problem appeared after an update, sudo apt upgrade
, on Ubuntu 20.04 (Focal Fossa).
Previously, I worked on versions Node.js 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 and Node.js v18.4.0.
When running the command npm start
, I receive 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.js version shows the same error:
node -v
Output:
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
Attempt to update:
nvm install 12.13.0
Output:
v12.13.0 is already installed.
Now using node v12.13.0 (npm v)
Upvotes: 100
Views: 362232
Reputation: 1
Just typing in the PowerShell window is well done for me :
$env:NODE_OPTIONS =""
Upvotes: -1
Reputation: 3960
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.js again.
Upvotes: 102
Reputation: 137
Just to give a background I am using @angular/[email protected] for learning and education purpose. I was also getting "ERR_OSSL_EVP_UNSUPPORTED" error. Then i was running "node-options" but didn't worked for me. But "NODE_OPTIONS" worked for me. Below is my complete command which worked for me.
I am using PowerShell as my terminal.
$env:NODE_OPTIONS = "--openssl-legacy-provider"
npx -p @angular/[email protected] ng serve
Issue with this is that yo have to set it again and again when you close your IDE and run again and again. To resolve this issue I have found permanent solution.
I just ran.
npm config edit
it will add .npmrc in your window user directory and in that file we have to add
node-options=--openssl-legacy-provider
it will work and you don't have to run again and again.
Upvotes: 1
Reputation: 359
if you are new to React native development
and using mac m1 chip. using xcode,
it automatically opens up the terminal and runs npm start
This terminal might be using some other node version. my project was using node 14, but globally 16 was set.
You can choose one
Globally set to 14 (other project might get affected)
nvm alias default 14
OR open a new terminal in the project directory
nvm use 14
npm start
and run xcode build start
Upvotes: 0
Reputation: 509
We can set the SSL legacy option in the .npmrc file.
In my case Node.JS v18 with npm v9.
node-options="--openssl-legacy-provider"
Upvotes: 43
Reputation: 91
For me, I was on Node.js 16 and I just upgraded to Node.js v18 (NODE_OPTIONS may be a red herring).
Also, the variable was not exported to the env (so there wasn't any way to unset it), but it was part of the command (in package.json), i.e., "serve": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve"
Upvotes: 1
Reputation: 19
Using Node.js 18.18.2 and export NODE_OPTIONS=--openssl-legacy-provider
to the start script:
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "export NODE_OPTIONS=--openssl-legacy-provider && react-native start",
"test": "jest",
"lint": "eslint ."
},
solved my issue.
Upvotes: 2
Reputation: 4471
I had the same issue with React Native, ./gradlew assembleRelease.
I solved this by downgrading Node.js version to v18.17.0 and setting Node.js options as --openssl-legacy-provider
Commands
nvm install v18
nvm use v18
export NODE_OPTIONS=--openssl-legacy-provider
Upvotes: 4
Reputation: 15640
You can try to downgrade the version. But as a quick fix, you can do the below options.
On Unix-like systems (Linux, macOS, Git Bash, etc.):
export NODE_OPTIONS=--openssl-legacy-provider
On the Windows command prompt:
set NODE_OPTIONS=--openssl-legacy-provider
In PowerShell:
$env:NODE_OPTIONS = "--openssl-legacy-provider"
Upvotes: 16
Reputation: 129
Two ways to fix it:
Try resetting NODE_OPTIONS
by running the following command:
export NODE_OPTIONS=""
Upgrade to Node.js 18
nvm use v18
Upvotes: 4
Reputation: 11
The previous answers were good suggestions. However, what worked for me was commenting the entry in the .npmrc file located in my project folder as shown here.
Upvotes: 1
Reputation: 121
I'm running macOS. I previously had Node.js version 18, which had this issue in my Node.js project:
Error message "error:0308010C:digital envelope routines::unsupported"
I downgraded the Node.js 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
Upvotes: 9
Reputation: 470
For me unsetting NODE_OPTIONS alone didn't solve the problem. I had to use
nvm use v18
to solve the issue.
Upvotes: 37
Reputation: 1008
On Linux, you need to edit your /etc/ssl/openssl.cnf file to uncomment 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
Upvotes: 21
Reputation: 76
You can try to perform an unset on the NODE_OPTIONS production variable. It can be done from the command line.
Your Node.js version seems already up-to-date (version 18). A similar problem was already treated and solved according to the GitHub page Running code via CLI triggers error: --openssl-legacy-provider is not allowed in NODE_OPTIONS #136599.
Upvotes: 6
Reputation: 1669
I was facing Error on yarn start
. Error screenshot is attached below
Now I fixed this by following steps: open pakage.json and change script object
"scripts": {
"android": "react-native run-android",
"build_debug": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
"ios": "react-native run-ios",
"start": "cross-env NODE_OPTIONS= --openssl-legacy-provider start",
"test": "jest",
"lint": "eslint .",
"android_apk": "npx react-native run-android --variant=release"
},
with this
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"build": "react-native run-android --mode=release",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
And second step I performed is that created a .env file in my React Native Project root directory and place the below code in it
NODE_OPTIONS="--openssl-legacy-provider"
And again run yarn start
command
Upvotes: 0