Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
Node.js 17+ uses OpenSSL 3.0, which removed support for some older algorithms. Your build tool (Webpack, Create React App, etc.) is using one of them.
Fix 1: Use the Legacy OpenSSL Provider
# Set the environment variable
export NODE_OPTIONS=--openssl-legacy-provider
# Or inline
NODE_OPTIONS=--openssl-legacy-provider npm run build
// package.json — add to scripts
{
"scripts": {
"build": "NODE_OPTIONS=--openssl-legacy-provider react-scripts build",
"start": "NODE_OPTIONS=--openssl-legacy-provider react-scripts start"
}
}
Fix 2: Downgrade Node.js
# Use Node.js 16 (LTS with OpenSSL 1.1)
nvm install 16
nvm use 16
npm run build
Fix 3: Upgrade Your Build Tool
The real fix — update to a version that supports OpenSSL 3.0:
# Create React App
npm install react-scripts@latest
# Webpack
npm install webpack@latest
# Or migrate to Vite (no OpenSSL dependency)
Fix 4: Windows
# PowerShell
$env:NODE_OPTIONS="--openssl-legacy-provider"
npm run build
# Or in package.json
"build": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
Fix 5: Docker
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN npm run build
Why This Happens
Node.js 17+ ships with OpenSSL 3.0, which deprecated the MD4 algorithm used by Webpack’s hashing. Older versions of Webpack, Create React App, and other tools rely on this algorithm.