JavaScript

Digital Envelope Routines :: Initialization Error Unsupported ERR_OSSL_EVP_UNSUPPORTED Problem Solution

If you updated NodeJS to the latest version or if you cloned old projects which doesnt support or work with newer version of Node.Js you will probably take errors something like below:

Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at stableHash (/Users/…/node_modules/metro-cache/src/stableHash.js:19:8) at Object.getCacheKey (/Users/…/node_modules/metro-transform-worker/src/index.js:593:7) at getTransformCacheKey (/Users/…/node_modules/metro/src/DeltaBundler/getTransformCacheKey.js:24:19) at new Transformer (/Users/…/node_modules/metro/src/DeltaBundler/Transformer.js:48:9) at /Users/…/node_modules/metro/src/Bundler.js:22:29 at processTicksAndRejections (node:internal/process/task_queues:96:5) { opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ], library: ‘digital envelope routines’, reason: ‘unsupported’, code: ‘ERR_OSSL_EVP_UNSUPPORTED’ }

OR

error: TypeError: Cannot read properties of undefined (reading ‘transformFile’) at Bundler.transformFile (/Users/…/node_modules/metro/src/Bundler.js:48:30) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Object.transform (/Users/…/node_modules/metro/src/lib/transformHelpers.js:101:12) at async processModule (/Users/…/node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18) at async traverseDependenciesForSingleFile (/Users/…/node_modules/metro/src/DeltaBundler/traverseDependencies.js:131:3) at async Promise.all (index 0) at async initialTraverseDependencies (/Users/…/node_modules/metro/src/DeltaBundler/traverseDependencies.js:114:3) at async DeltaCalculator._getChangedDependencies (/Users/…/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:164:25) at async DeltaCalculator.getDelta (/Users/…/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:94:16)

You can solve these problems with using NVM or N packages. And tehn you can install and activate older NodeJS versions for start or run your React Native projects. NVM means Node Version Manager.

You should download exe file and then you can setup NVM from this file.

Installation & Upgrades

⭐ ⭐ Uninstall any pre-existing Node installations!! ⭐ ⭐

Uninstall any existing versions of Node.js before installing NVM for Windows (otherwise you’ll have conflicting versions). You can delete existing NodeJS version from “Add or Remove Programs” section on Windows OS. Then, delete any existing Node.js installation directories (e.g., %ProgramFiles%\nodejs) that might remain. NVM’s generated symlink will not overwrite an existing (even empty) installation directory.

👀 Backup any global npmrc config 👀 (e.g. %AppData%\npm\etc\npmrc)

Alternatively, copy the settings to the user config %UserProfile%\.npmrc. Delete the existing npm install location (e.g. %AppData%\npm) to prevent global module conflicts.

Install nvm-windows

Use the latest installer (comes with an uninstaller).

After installed successfully with this exe file, you can download which version of NodeJS do you want. You can download nodejs version with this command:

nvm install 16.13.0

You can write version numbers and if you want latest stable version of Node.JS you can write this command:

nvm install lts

After all when you write for example nvm use 16.13.0 you can use Node JS version of 16.13.0 for your project to start / run. Therefore you will be saved from incompatible Node JS version problems.

After all for example if you want use Yarn again, you should write npm install -g Yarn command to install it again for you can use again.

—————————————————

IMPORTANT TIPS FOR USING NVM PACKAGE:

  • > nvm list // to see all available installed node versions
  • > nvm install 16.13.0 // to install the version I wanted
  • > nvm use 16.13.0 // use the installed version
  • OR
  • > nvm alias default 16 // use the installed version as DEFAULT

—————————————————–

Usage:

nvm-windows runs in an Admin shell. You’ll need to start powershell or Command Prompt as Administrator to use nvm-windows

NVM for Windows is a command line tool. Simply type nvm in the console for help. The basic commands are:

  • nvm arch [32|64]: Show if node is running in 32 or 64 bit mode. Specify 32 or 64 to override the default architecture.
  • nvm check: Check the NVM4W process for known problems.
  • nvm current: Display active version.
  • nvm install <version> [arch]: The version can be a specific version, “latest” for the latest current version, or “lts” for the most recent LTS version. Optionally specify whether to install the 32 or 64 bit version (defaults to system arch). Set [arch] to “all” to install 32 AND 64 bit versions. Add --insecure to the end of this command to bypass SSL validation of the remote download server.
  • nvm list [available]: List the node.js installations. Type available at the end to show a list of versions available for download.
  • nvm on: Enable node.js version management.
  • nvm off: Disable node.js version management (does not uninstall anything).
  • nvm proxy [url]: Set a proxy to use for downloads. Leave [url] blank to see the current proxy. Set [url] to “none” to remove the proxy.
  • nvm uninstall <version>: Uninstall a specific version.
  • nvm use <version> [arch]: Switch to use the specified version. Optionally use latestlts, or newestnewest is the latest installed version. Optionally specify 32/64bit architecture. nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode. For information about using use in a specific directory (or using .nvmrc), please refer to issue #16.
  • nvm root <path>: Set the directory where nvm should store different versions of node.js. If <path> is not set, the current root will be displayed.
  • nvm version: Displays the current running version of NVM for Windows.
  • nvm node_mirror <node_mirror_url>: Set the node mirror.People in China can use https://npmmirror.com/mirrors/node/
  • nvm npm_mirror <npm_mirror_url>: Set the npm mirror.People in China can use https://npmmirror.com/mirrors/npm/

Best,
Aytac AGMA

You can share and save this page with:
Tags: , , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*