Node.js "digital envelope routines::unsupported" (Webpack 4) in CI
Webpack 4 hashes chunks with a legacy algorithm OpenSSL 3 (Node 17+) no longer enables by default. The bundler crashes with the digital-envelope-routines error before output is written.
What this error means
A Webpack 4 build crashes on a newer Node version with digital envelope routines::unsupported. Pinning to old Node makes it build again.
node
Error: error:0308010C:digital envelope routines::unsupported
at Object.createHash (node:crypto:139:10)
at module.exports (.../webpack/lib/util/createHash.js:135:53)
code: 'ERR_OSSL_EVP_UNSUPPORTED'Common causes
Webpack 4 uses a legacy hash
Webpack 4 defaults chunk hashing to an algorithm OpenSSL 3 gates behind the legacy provider, so a Node upgrade breaks it.
How to fix it
Upgrade to Webpack 5
Webpack 5 uses an OpenSSL-3-compatible hash. Upgrading removes the incompatibility for good.
- Upgrade webpack and webpack-cli to v5.
- Update loaders/plugins to v5-compatible versions.
- Rebuild and remove any legacy-provider flag.
Enable the legacy provider as a bridge
Set the OpenSSL legacy provider while the Webpack 4 upgrade is pending.
workflow
NODE_OPTIONS=--openssl-legacy-provider npm run buildHow to prevent it
- Keep the bundler current so it works with OpenSSL 3.
- Pin Node and test upgrades before bumping CI.
- Avoid baking the legacy-provider flag into permanent config.
Related guides
Node.js "error:0308010C:digital envelope routines::unsupported" in CIFix "error:0308010C:digital envelope routines::unsupported" in CI - OpenSSL 3 in newer Node rejects a legacy…
Node "error:0308010C digital envelope routines unsupported" in CI - Fix OpenSSL 3Fix the Node.js "error:0308010C digital envelope routines::unsupported" OpenSSL 3 error in CI by upgrading th…
Node --openssl-legacy-provider ERR_OSSL in CI - Fix Digital Envelope ErrorsFix "error:0308010C digital envelope routines::unsupported" (ERR_OSSL) in npm builds on Node 17+ by upgrading…