How to fix digital envelope routines::unsupported when trying to Build shell getting

When trying to Setting Up a Front-End Extension Module reaching point 7. Build core specifically the yarn run build:shell command I get the following error message

➜  $  yarn run build:shell                                                                                                
yarn run v1.22.19                                                                                                                                                     
$ ng build shell --configuration production                                                                                                                           
Warning: Support was requested for IE 11 in the project's browserslist configuration. IE 11 support is deprecated since Angular v12.                                  
For more information, see https://angular.io/guide/browser-support                                                                                                    
⠙ Generating browser application bundles (phase: building)...node:internal/crypto/hash:71                                                                             
  this[kHandle] = new _Hash(algorithm, xofLen);                                                                                                          
                  ^                                                                                                                                                   
                                                                                                                                                                      
Error: error:0308010C:digital envelope routines::unsupported                                                                                                          
    at new Hash (node:internal/crypto/hash:71:19)                                                                                                                     
    at Object.createHash (node:crypto:133:10)                                                                                                                         
    at BulkUpdateDecorator.hashFactory (/var/www/sonar-crm.local/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/util/createHash.js:145:18)
    at BulkUpdateDecorator.digest (/var/www/sonar-crm.local/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/util/createHash.js:80:21)             
    at NormalModule._initBuildHash (/var/www/sonar-crm.local/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:884:53)              
    at /var/www/sonar-crm.local/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:924:10                                            
    at processResult (/var/www/sonar-crm.local/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:720:12)
    at /var/www/sonar-crm.local/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:819:5
    at /var/www/sonar-crm.local/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /var/www/sonar-crm.local/node_modules/loader-runner/lib/LoaderRunner.js:251:18 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],                                                                            
  library: 'digital envelope routines',                                                                                                                               
  reason: 'unsupported',                                                                                                                                              
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.14.1
error Command failed with exit code 1.                                                                                                                                
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 

Node version: v18.14.1

Any idea how to fix this behavior?

kind regards

Running into the same issue on Node.js v17.8.0, did you ever work out how to get around this issue?

EDIT: Looks like using Node.js v14.x allowed me to build the project correctly - I used nvm to manage multiple versions.

Hey guys!

Ran into the same issue but with Node v20.9.0.

You can resolve this issue (for the development environment) by executing this (works on Windows for me):

export NODE_OPTIONS=--openssl-legacy-provider

Hi, Mario!

Anyway, there’s a problem with OpenSSL 3 in Node.js. As others have mentioned, for a quick fix, try running the following command before building:

export NODE_OPTIONS=--openssl-legacy-provider
yarn run build:shell

Also check if the Angular CLI and Yarn are up to date. For example, Angular 12 may not fully support Node.js 18. And sometimes it helps if you update.

In big projects, compatibility issues like this are a bitch.

If you’re getting ERR_OSSL_EVP_UNSUPPORTED while running yarn run build: shell, it’s due to Node.js using OpenSSL 3, which breaks some older crypto features. A quick fix is to run:
bash

export NODE_OPTIONS=--openssl-legacy-provider  

Then try the build command again. Also, make sure your Angular version and Yarn are updated, as older setups may not fully support recent Node.js versions. It arises when an application needs to use an encryption, decryption, signing, or verification algorithm not supported or implemented by the version of OpenSSL being used. There are many causes and different ways to fix the error, which you need to understand in detail.

I hope it helps!

@camiliya the link you added was removed my a moderator. Don’t add it again or you will be banned from the Community.

The reason for this is that many users come here only intending to do SEO for their companies, and we don’t condone that.

A post that only repeats what the previous post said, and adds an external link, is very suspicious coming from a new user.