Skip to content
Latchkey

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.

  1. Upgrade webpack and webpack-cli to v5.
  2. Update loaders/plugins to v5-compatible versions.
  3. 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 build

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →