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

Question:

Error: error:0308010C:digital envelope routines::unsupport
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10at module.exports (/Users/itquestionanswer/WebServer/untitled/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/itquestionanswer/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/itquestionanswer/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/itquestionanswer/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/itquestionanswer/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/itquestionanswer/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/itquestionanswer/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/Users/itquestionanswer/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/Users/itquestionanswer/WebServer/untitled/node_modules/react-scripts/scripts/start.js:19
  throw err; 

Verified Answer:

For Windows

  1. first download and install nvm, click here to download nvm-windows.

  2. Install the Node.js version that you want.

nvm install 18 

3. Change your Node.js version

nvm use 18 

4. Check the Node.js versions installed

nvm list 

For macOS

Set the NODE_OPTIONS environment variable to –openssl-legacy-provider. To do this, open your terminal and run the below command:

export NODE_OPTIONS=--openssl-legacy-provider 

Note: this command also used for Linux or Windows Git Bash