[Fixed] Node.js ERR_OSSL_EVP_UNSUPPORTED error when running npm run start – Node.js

by
Ali Hasan
jruby-openssl node.js

Quick Fix: Set the NODE_OPTIONS environment variable to –openssl-legacy-provider before running the npm start command.

The Problem:

When running npm run start in a Node.js project, the error ERR_OSSL_EVP_UNSUPPORTED occurs. The error message mentions ‘unsupported digital envelope routines’, and the user has tried changing Node.js versions without success. The port is confirmed to be empty and no processes are running that could interfere. It is requested to determine the cause and provide a solution.

The Solutions:

Solution 1: Use a legacy cryptography provider

The error is caused by a mismatch between the version of Node.js you are using and the version of OpenSSL on your system. To resolve this issue, you can use a legacy cryptography provider by setting the NODE_OPTIONS environment variable to –openssl-legacy-provider before running the npm run start command. This will force Node.js to use a legacy version of OpenSSL that is compatible with your system.

Solution 2: Downgrade OpenSSL version or use `–openssl-legacy-provider` option

The error ERR_OSSL_EVP_UNSUPPORTED is often encountered when an application tries to use an algorithm or key size that’s no longer allowed with OpenSSL 3.0. To resolve this issue, you can either upgrade Node.js to the latest LTS version or use the --openssl-legacy-provider option.

For Linux:

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

For Windows:

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

Q&A

How can I fix ERR_OSSL_EVP_UNSUPPORTED error?

Add –openssl-legacy-provider option to NODE_OPTIONS.

What does the ERR_OSSL_EVP_UNSUPPORTED error mean?

Algorithm or key size is no longer allowed by default with OpenSSL 3.0.

Video Explanation:

The following video, titled "Related Video", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

This video provides further insights and detailed explanations related to the content discussed in the article.