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.

1 Like

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. When we had such problems at Andersen, we brought in experienced people who know Node.js and Salesforce.