The error, verbatim
Jump to the fix ↓Error: error:0308010C:digital envelope routines::unsupported
opensslErrorStack: [
'error:03000086:digital envelope routines::initialization error',
'error:0308010C:digital envelope routines::unsupported'
],
library: 'digital envelope routines',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
Tested on
- Node
- 24.14.0
- Broken
- webpack 4.46.0 + webpack-cli 3
- Fixed
- webpack 4.47.0
- OS
- Windows 11 Pro
Contents
The fix
Best quick fix: upgrade webpack 4 to 4.47.0
You don’t have to jump to webpack 5. The last webpack 4 release handles this itself:
npm install -D webpack@4.47.0
If webpack comes from a tool you don’t control (an old react-scripts, vue-cli or similar), check which webpack it installed with npm ls webpack. Pinning 4.47.0 with overrides in package.json may work there too. I didn’t test those tools for this post.
Fallback: the legacy OpenSSL provider
# macOS / Linux
NODE_OPTIONS=--openssl-legacy-provider npm run build
# Windows PowerShell
$env:NODE_OPTIONS = "--openssl-legacy-provider"; npm run build
It works, but it re-enables old, weaker algorithms for the whole Node process. Treat it as a stopgap, not the fix.
Long term
Move to webpack 5 or a current build tool. Webpack 4 no longer gets updates, and 4.47.0 is its final release.
Why it happens
Webpack 4 hashes files with the md4 algorithm through Node’s crypto. Node 17 switched to OpenSSL 3, which disables legacy algorithms like md4 by default. Asking for it fails with 0308010C: digital envelope routines::unsupported. Webpack 4.47.0 added its own md4 implementation, so it no longer asks OpenSSL for it.
What didn’t work
— N.K., end of entry No.004