Node "error:0308010C digital envelope routines::unsupported" - Fix OpenSSL 3 Build Break
Node 17+ ships OpenSSL 3, which removed the legacy MD4 hashing older tooling (notably webpack 4) relies on. The build crashes with error:0308010C ... digital envelope routines::unsupported.
What this error means
A build that worked on Node 16 fails on Node 17+ with Error: error:0308010C:digital envelope routines::unsupported, usually from webpack’s chunk hashing or a transitive crypto call. The code did not change - the Node/OpenSSL version did.
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash)
...
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED'Common causes
Old tooling uses an algorithm OpenSSL 3 disabled
webpack 4 (and some older loaders) hash with MD4 via the legacy provider, which OpenSSL 3 in Node 17+ no longer enables by default.
CI bumped Node to 17+ under old build tooling
Upgrading the runner’s Node major without upgrading webpack/build tooling exposes the OpenSSL 3 incompatibility.
How to fix it
Re-enable the legacy provider (stopgap)
Tell Node to allow the legacy OpenSSL provider for the build.
NODE_OPTIONS=--openssl-legacy-provider npm run build
# or in a workflow:
env:
NODE_OPTIONS: --openssl-legacy-providerUpgrade the tooling (proper fix)
- Upgrade to webpack 5 (or the framework version that ships it), which uses OpenSSL-3-compatible hashing.
- Update loaders/plugins that call legacy crypto.
- Once upgraded, remove the
--openssl-legacy-providerflag.
How to prevent it
- Keep build tooling current with the Node/OpenSSL version in CI.
- Bump Node majors and webpack together, not in isolation.
- Drop the legacy provider flag after upgrading.