8

I am constantly getting the ERR_OSSL_EVP_UNSUPPORTED error, I did some research on the internet, I did what was said, but the error did not get fixed, what could be the reason? json.package is as follows.

{


"name": "intelijReactNative",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "build": "react-scripts --openssl-legacy-provider build",
    "start": "react-scripts --openssl-legacy-provider start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.66.3"
  },
  "devDependencies": {
    "@babel/core": "7.16.0",
    "@babel/runtime": "7.16.3",
    "@react-native-community/eslint-config": "2.0.0",
    "babel-jest": "26.6.3",
    "eslint": "7.14.0",
    "jest": "26.6.3",
    "metro-react-native-babel-preset": "0.66.2",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }

the error is as below

Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at stableHash (C:\Users\furka\Desktop\intelijReactNative\node_modules\metro-cache\src\stableHash.js:19:8)
    at Object.getCacheKey (C:\Users\furka\Desktop\intelijReactNative\node_modules\metro-transform-worker\src\index.js:593:7)
    at getTransformCacheKey (C:\Users\furka\Desktop\intelijReactNative\node_modules\metro\src\DeltaBundler\getTransformCacheKey.js:24:19)
    at new Transformer (C:\Users\furka\Desktop\intelijReactNative\node_modules\metro\src\DeltaBundler\Transformer.js:48:9)
    at C:\Users\furka\Desktop\intelijReactNative\node_modules\metro\src\Bundler.js:22:29
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:497:9) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Ironman42
  • 81
  • 1
  • 1
  • 2
  • 1
    Does this answer your question? [Error message "error:0308010C:digital envelope routines::unsupported"](https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported) – Evan Carroll Nov 22 '21 at 17:02
  • https://github.com/facebook/create-react-app/issues/11562 has the details, why to downgrade NodeJs to v16.13.0 – Abhinav Saxena Dec 21 '21 at 08:31

2 Answers2

12

I had the same error. If you are using Node version 17+, It isn't compatible with some webpack stuff yet. Use the LTS version instead. At v16.13.0

Ellon
  • 185
  • 6
  • 3
    @Ellon I have issuen when running this code `npx react-native run-android --variant=release` got error even I downgraded from 16.14.0 to 16.13.0 – Eggy Feb 11 '22 at 19:09
0

Remove --openssl-legacy-provider from script and downgrade your node version to 16

If you use export NODE_OPTIONS=--openssl-legacy-provider you can use unset NODE_OPTIONS in terminal

If you set that export with fish first check to see that with printenv | grep NODE_OPTIONS and if you see NODE_OPTIONS=--openssl-legacy-provider now you can use set -e NODE_OPTIONS for unset from fish

If you can not downgrade node version because you may have used version 17+ in a project, then use n package and install version 16 of Node and switch between the required versions of Node during the development of each project using this package.

Also, it would be nice to use sudo while using npm n on macOS or Linux