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.
If you’re seeing this on Node 17 or later, the issue likely stems from how Webpack handles crypto under the hood. In cases like this, downgrading just Node isn’t enough - Webpack and related packages might also need updates.
I’d suggest bumping Webpack to version 5.61+ (or later), which added better compatibility with OpenSSL 3:
npm install webpack@latest --save-dev
Then clean your node_modules and rebuild:
rm -rf node_modules
npm install
Once Webpack is upgraded, the openssl error usually disappears without needing any legacy flags.