Question:
Fix Error: error:0308010C:digital envelope routines

Query: Fix Error: error:0308010C:digital envelope routines::unsupported with react na…


Problem

I have a react native web app. And after I do expo start. I choose for w-web. But then I get this error:


] 10%Error: error:0308010C:digital envelope routines::unsupported

at new Hash (node:internal/crypto/hash:68:19)


I am using node.js version v20.10.0.


And my package.json file looks like:


  "scripts": {

    "start": "expo start, react-app-rewired start --openssl-legacy-provider ",

    "android": "expo start --android",

    "ios": "expo start --ios",

    "web": "expo start --web",

    "eject": "expo eject",

    "lint": "eslint . --ext .js",

    "postinstall": "patch-package",

    "build": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build",

    "start-webpack": "webpack-dev-server --mode production --open"

  },


Question: how to resolve the error: error:0308010C:digital envelope routines::unsupported


Solution

The error caused by version incompatibility between node.js and OpenSSL. And one way to solve it is using a flag called --openssl-legacy-provider that can setup in package.json.


"scripts": {

   "start": "expo start --openssl-legacy-provider",

   ...

}


If encountering error like;


Error: Cannot find module 'expo/config'


Make sure expo already installed in project by running npm install expo or yarn add expo.


If done already and still error check the module reference. You should use require('@expo/config') not require('expo/config'). You can find the file at "AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\webpack\env" (like on this case).


Suggested blogs:

>How to conditionally render different arrays in React?

>Fix react useState and array.map not work issue

>Making infinite scrolling using react-query

>How does React State with JSON arrays affect performance?

>setlist{nosep} not work in the acronym package

>Fix ScrollIntoView not working issue

>Testing react component with jest

>How you can Show or hide elements in React?

>Testing react components using Hooks and Mocks

>Tips for using React Redux Hooks to show or hide React components


Nisha Patel

Nisha Patel

Submit
0 Answers