I recently worked on a Nuxt project and couldn’t build it because of a code: ‘ERR_OSSL_EVP_UNSUPPORTED’
error. I found out this is a common Node.js 17 problem that can also occur in Webpack-based projects in React, Next.js and Gatsby.
NODE.js ERR_OSL_EVP_UNSUPPORTED ERROR Explained
ERR_OSL_EVP_UNSUPPORTED
is an error that occurs in Node.js 17 when your application or one of its modules attempts to use an algorithm or key size that’s no longer allowed by default in OpenSSL 3.0. You can fix it by either downloading the latest Node.js LTS version or using the --openssl-legacy-provider
.
Let’s learn what ERR_OSSL_EVP_UNSUPPORTED
is and how to fix it.
What Is ERR_OSSL_EVP_UNSUPPORTED?
As mentioned in the Node.js 17 release notes, ERR_OSSL_EVP_UNSUPPORTED
generally occurs when your application or one of its modules attempts to use an algorithm or key size that’s no longer allowed by default with OpenSSL 3.0.
Node.js 17 includes OpenSSL 3.0 for QUIC support. Even though OpenSSL 3.0 APIs should be mostly compatible with OpenSSL 1.1.1, there may be some issues with tightened restrictions on the algorithms and key sizes allowed. In other words, Node.js throws an ERR_OSSL_EVP_UNSUPPORTED
error to prevent you from using a feature that OpenSSL removed for security reasons.
How to Fix the ERR_OSSL_EVP_UNSUPPORTED Error
There are two ways to fix the ERR_OSSL_EVP_UNSUPPORTED
error:
- Upgrade Node.js by downloading and installing the latest Node.js LTS version.
- Use the
--openssl-legacy-provider
option.
If you can’t or don’t want to update your Node.js version, you can fix the problem with a workaround. Node.js 17 introduced the --openssl-legacy-provider
command line option to revert to the legacy OpenSSL provider.
Use --openssl-legacy-provider
in the startnpm
script as follows:
NODE_OPTIONS=--openssl-legacy-provider npm run start
On Windows, it becomes:
set NODE_OPTIONS=--openssl-legacy-provider && npm run start
In React, update the start
and build
scripts in package.json
with:
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build"
Et voilà! Your application should now work like a charm.
ERR_OSSL_EVP_UNSUPPORTED
is an annoying error. Addressing it isn’t difficult. You should now understand why Node.js 17 raises that error and how to fix it with the --openssl-legacy-provider
command line option.