Node --openssl-legacy-provider ERR_OSSL in CI - Fix Digital Envelope Errors
Node 17+ uses OpenSSL 3, which dropped a legacy hash older Webpack used. A build fails with ERR_OSSL_EVP_UNSUPPORTED until you upgrade the tooling or opt into the legacy provider.
What this error means
npm run build crashes on Node 17 or newer with error:0308010C:digital envelope routines::unsupported, typically from an older Webpack 4 or create-react-app toolchain.
npm
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:69:19)
code: 'ERR_OSSL_EVP_UNSUPPORTED'Common causes
OpenSSL 3 dropped a hash older tooling relies on
Node 17+ ships OpenSSL 3, and old Webpack uses an MD4-based hash that is no longer available by default.
How to fix it
Upgrade the build tooling (preferred)
- Upgrade to a Webpack 5 / modern toolchain that uses a supported hash.
- This removes the need for the legacy flag entirely.
Set the legacy OpenSSL provider as a stopgap
- Set NODE_OPTIONS to enable the legacy provider for the build.
- Treat it as temporary until the toolchain is upgraded.
Workflow
env:
NODE_OPTIONS: --openssl-legacy-providerHow to prevent it
- Upgrade build tooling to support OpenSSL 3 and pin the Node version, so you do not depend on a deprecated legacy provider flag long term.
Related guides
Node.js ERR_OSSL_EVP_UNSUPPORTED - Fix "digital envelope routines"Fix Node.js ERR_OSSL_EVP_UNSUPPORTED "error:0308010C:digital envelope routines::unsupported" in CI - OpenSSL…
Node "error:0308010C digital envelope routines::unsupported" - Fix OpenSSL 3 Build BreakFix "Error: error:0308010C:digital envelope routines::unsupported" in CI - Node 17+ on OpenSSL 3 breaking old…
npm run build Exited With Code 1 in CI - Diagnose Build FailuresDiagnose "npm run build exited with code 1" in CI by reading the real build error above the npm wrapper inste…