When I ran command dotnet publish to build ASP.NET Core 6 + SPA. I got an Error
Error : error : 0308010C:digital envelope routines::unsupported [C:\Users\invest\.jenkins\workspace\INVEST_NET6\ Web\ds.Invest.WebAPI\Wmsl.Invest.WebApi.csproj] at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) at module.exports (C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_mo dules\webpack\lib\util\createHash.js:135:53) at NormalModule._initBuildHash (C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_modules\webpack\lib\NormalModule.js:417:16) at handleParseError (C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_modules\webpack\lib\NormalModule.js:471:10) at C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_modules\webpack\lib\NormalModule.js:503:5 at C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_modules\webpack\li b\NormalModule.js:358:12 at C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_modules\loader-runner\lib\LoaderRunner.js:373:3 at iterateNormalLoaders (C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_modules\loader-runner\lib\LoaderRunner.js:214:10) at iterateNormalLoaders (C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\n ode_modules\loader-runner\lib\LoaderRunner.js:221:10) at C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_modules\loader-run ner\lib\LoaderRunner.js:236:3 at context.callback (C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_ modules\loader-runner\lib\LoaderRunner.js:111:13) at Object.loader (C:\Users\invest\.jenkins\workspace\INVEST_NET6\Web\ds.Invest.WebAPI\ClientApp\node_mod ules\css-loader\dist\index.js:183:3) { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' } Node.js v18.12.1
Cause
- Breaking Change on WebPack 4 > 5 (Security Issue)
Source nodejs 17: digital envelope routines::unsupported · Issue #14532 · webpack/webpack (github.com)
Solution
Workaround
- Windows
//Command Line set NODE_OPTIONS=--openssl-legacy-provider //Powershell $env:NODE_OPTIONS = "--openssl-legacy-provider"
- Linux
export NODE_OPTIONS=--openssl-legacy-provider
Permanent
- Update WebPack 4.x.x > 5.61.0
NOTE: if you cannot update node.js due to business / constraint / risk. you can use NVM (Node Version Manager) to switch between node.js version.
Reference
- nodejs 17: digital envelope routines::unsupported · Issue #14532 · webpack/webpack (github.com)
- node.js - Error message "error:0308010C:digital envelope routines::unsupported" - Stack Overflow
- Webpack build failing with ERR_OSSL_EVP_UNSUPPORTED - Stack Overflow
- How to Update NPM Dependencies (freecodecamp.org)
Discover more from naiwaen@DebuggingSoft
Subscribe to get the latest posts sent to your email.