How do I fix the err_ossl_evp_unsupported issue when running npm run start with Node.js?

I’m running into the err_ossl_evp_unsupported error while starting my Node.js project using npm run start. The error looks like this:

ex.js:59:103 {
  opensslErrorStack: ['error:03000086:digital envelope routines::initialization error'],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v19.8.1 ERROR: "front" exited with 1.

I verified that no other process is using the port and even downgraded to Node v14.17 using nvm, but the problem still occurs. It seems related to OpenSSL 3 being stricter in newer Node versions. What’s the best way to resolve the err_ossl_evp_unsupported error—should I set an environment variable, update a dependency, or something else?

One quick fix that has worked reliably for me is to set an environment variable to allow legacy OpenSSL behavior. Since OpenSSL 3.x tightened defaults, Node.js apps that use Webpack or older crypto functions can trigger this error.

Try starting your app like this:

NODE_OPTIONS=--openssl-legacy-provider npm run start

You can also make this change permanent in your package.json:

"scripts": {
  "start": "NODE_OPTIONS=--openssl-legacy-provider react-scripts start"
}

This doesn’t fix the root cause in your dependencies, but it gets your app running again, especially useful for development or older Webpack/React stacks.