赛派号

脸上无论用什么护肤品都发红 How To Fix the ERR

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.

More on Software EngineeringInstall Node.js: A Tutorial

 

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.

More on Software EngineeringGuide to the JaScript Array Filter() Method

 

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.

A guide on how to fix Node.js “ERR_OSSL_EVP_UNSUPPORTED” Error. | Video: Huy Nguyen USA

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.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lsinopec@gmail.com举报,一经查实,本站将立刻删除。

上一篇 没有了

下一篇没有了