Home > Web Front-end > JS Tutorial > My learnings through Error message 'error:digital envelope routines::unsupported”

My learnings through Error message 'error:digital envelope routines::unsupported”

Barbara Streisand
Release: 2024-12-25 09:24:09
Original
819 people have browsed it

While I was working on my full-stack application, I came across this cryptographic error and when I searched for it on StackOverflow and ChatGPT, I got to know it got arised due to changes in Node.js's handling of OpenSSL, affecting cryptographic operations,i.e., my application was attempting to use cryptographic algorithms or features that are no longer supported in the current OpenSSL version bundled with Node.js. So, the error actually came from the dependency I downloaded relying on an obsolete version of SSL.

Thereupon, to fix this error :

  • Initially, I tried deleting my node_modules folder (from the frontend
    workspace/folder) and re-running npm install in order to reinstall
    the dependencies. However, this did not solve the issue.

  • Then, I now understood that I should be switching the deprecated
    algorithm to legacy mode in order to solve the compatibility issues.
    And, while surfing regarding the deprecated algorithms, it got me
    reminded of the SHA-1 in PGP (Pretty Good Privacy) I learnt in the
    prior semester in college, in Computer Networks. SHA-1 is a hashing
    algorithm which has become a deprecated algorithm because of the
    security issues.

My learnings through Error message “error:digital envelope routines::unsupported”

And continuing with the topic, since my app was a non-critical application which required some backward compatibility too, I decided to continue with using the --openssl-legacy-provider flag for a temporary workaround, as this would help me learn more about the possible errors that might occur, know more about causes and how to solve it, along with other various terms that I might possibly encounter during the process.

The --openssl-legacy-provider enables the use of legacy algorithms by instructing Node.js to utilize OpenSSL's legacy provider, thereby restoring support for such cryptographic functions.

So, in the terminal, i started with :

npm update
npm audit fix — force 

Copy after login

Then, on the package.json file, I made the following changes :

BEFORE :

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
}
Copy after login

AFTER :

"scripts": {
    "start": "react-scripts --openssl-legacy-provider start",
    "build": "react-scripts --openssl-legacy-provider build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
}
Copy after login

Now, this finally solved the issue and I loved how I progressed learning about different things just by trying to resolve this issue myself, learnings about how npm functions in detail, how versions are managed, about the deprecated and legacy algorithms, etc.

The above is the detailed content of My learnings through Error message 'error:digital envelope routines::unsupported”. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template