How To Fix the ERR_OSSL_EVP_UNSUPPORTED Error in Node.js

发布时间 2023-07-06 16:00:53作者: 易先讯

Fix the ERR_OSSL_EVP_UNSUPPORTED Error

There are two ways to fix the ERR_OSSL_EVP_UNSUPPORTED error:

  1. Upgrade Node.js by downloading and installing the latest Node.js LTS version.
  2. Use the --openssl-legacy-provider option.

If you cannot or do not want to update your Node.js version, you can fix the problem with a workaround. Specifically, Node.js 17 introduced the --openssl-legacy-provider command line option to revert to the legacy OpenSSL provider.

Use --openssl-legacy-provider in the start npm 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"

Check out this article to learn how to fix the error in other technologies and platforms.

Et voilà! Your application should now work like a charm!

Conclusion

ERR_OSSL_EVP_UNSUPPORTED is an annoying error. Anyway, addressing is not difficult and in this article you learned how to do it. In detail, you understood why Node.js 17 raises that error and how to fix it with the --openssl-legacy-provider command line option.

Thanks for reading! I hope you found this article helpful. Feel free to leave any questions, comments, or suggestions.