Logo

dev-resources.site

for different kinds of informations.

{ my learnings through Error message “error:0308010C:digital envelope routines::unsupported” }

Published at
12/19/2024
Categories
npm
react
javascript
techblogs
Author
shreyansii
Categories
4 categories in total
npm
open
react
open
javascript
open
techblogs
open
Author
10 person written this
shreyansii
open
{ my learnings through Error message “error:0308010C:digital envelope routines::unsupported” }

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 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.

Image description

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 root 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 

Enter fullscreen mode Exit fullscreen mode

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"
}
Enter fullscreen mode Exit fullscreen mode

AFTER :

"scripts": {
    "start": "react-scripts --openssl-legacy-provider start",
    "build": "react-scripts --openssl-legacy-provider build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
}
Enter fullscreen mode Exit fullscreen mode

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.

npm Article's
30 articles in total
Favicon
NPM command confusion
Favicon
My First npm Package!
Favicon
Introducing date-formatter-i18n: Simplify i18n for Dates in JavaScript
Favicon
Themeify: A Simple Tool to Beautify Your React and Next.js Projects
Favicon
Mi primera Libreria en NPM
Favicon
node unsupported engine when updating npm
Favicon
Starting with semver `1.0.0`
Favicon
My Experience with Node.js Version Compatibility: Leveraging the engines Field in package.json for AutoScout
Favicon
NPM Commands Every Web Developer Must Know
Favicon
Exploring npm: The Node Package Manager
Favicon
When GitHub Actions Build Fails Due to pnpm-lockfile
Favicon
Private npm Repositories
Favicon
🚀 Introducing pingflow: Your Ultimate Internet Speed Testing Tool! 🌐
Favicon
npm error 'node' is not recognized as an internal or external command
Favicon
Optimer for your project security and performance issues
Favicon
Publishing NPM package with Github Actions that react-hook-use-cta used
Favicon
Building My First NPM Package: A CLI for Scaffolding Express Servers
Favicon
Resolving Peer Dependency Errors in React: A Comprehensive Guide ⚡
Favicon
Building Scalable Microservices with Node.js and Event-Driven Architecture
Favicon
NPM Dependency error
Favicon
🎄 A Christmas Gift for Developers: FileToMarkdown!
Favicon
npm
Favicon
Fastly CLI on npm: now at your JavaScript fingertips
Favicon
{ my learnings through Error message “error:0308010C:digital envelope routines::unsupported” }
Favicon
Installing your react.js local package registry to your project
Favicon
External libraries: The Hidden Weight of External Libraries
Favicon
Simplifying your code: replacing heavy packages with lightweight solutions
Favicon
Lazy Devs, Rejoice! Automate Updates with Dependabot (and My Secret Sauce) 🍹📱
Favicon
Counter - A React library for animating numeric transitions
Favicon
What I learned building vue3-search-select package

Featured ones: