error:0308010C:digital envelope routines::unsupported (ERR_OSSL_EVP_UNSUPPORTED)
Most likely cause: webpack 4 (or a tool built on it) hashing with MD4 on Node.js 17 or newer
Try first: Check your Node.js and webpack versions (node -v && npx webpack --version)
Likely causes
- webpack 4 (or a tool built on it) hashing with MD4 on Node.js 17 or newermost likely
- An old react-scripts, @vue/cli-service, @angular-devkit or next version pinned in package.jsonpossible
- A CI image or Docker base image that moved to a newer Node.js versionless likely
Why this happens
Node.js 17 switched from OpenSSL 1.1 to OpenSSL 3. OpenSSL 3 moves old algorithms such as MD4 into a "legacy" provider that is off by default. webpack 4 uses MD4 to hash module contents, so crypto.createHash('md4') throws error:0308010C and the build stops. Your code is fine; the build tool is old.
Which fix to choose
- Active project: upgrade to webpack 5 or a current framework version. This is the only fix that lasts.
- Old project you just need to build once:
--openssl-legacy-provideror Node 16 via nvm. - Do not edit files in node_modules; the change is lost on the next install.
How to fix it
Check your Node.js and webpack versionsSafe
If Node is 17 or newer and webpack is 4.x, this is your error.
node -v && npx webpack --versionUpgrade the build tool (real fix)Changes settings
Upgrade to a version that uses webpack 5: react-scripts 5, a current Vue CLI or Vite, Angular 13+, Next.js 12+. Webpack 5.61+ also falls back to a built-in hash so it works on OpenSSL 3.
npm install react-scripts@latestStopgap: enable the legacy OpenSSL providerChanges settings
Set the variable for the build command only. On macOS/Linux:
NODE_OPTIONS=--openssl-legacy-provider npm start. On Windows PowerShell:$env:NODE_OPTIONS="--openssl-legacy-provider"; npm start. Remove it once you upgrade.NODE_OPTIONS=--openssl-legacy-provider npm run build⚠ This re-enables legacy algorithms for the whole Node.js process. Use it only for local builds until you upgrade.
Or pin the project to Node.js 16Changes settings
Using nvm or nvm-windows, install Node.js 16 for this project only. Node 16 is out of support, so treat this as temporary.
nvm install 16 && nvm use 16Fix CIChanges settings
Pin the Node version in CI (for example
node-version: 16in actions/setup-node, orFROM node:16in Docker) while you upgrade, so builds do not break when the image updates.
If that didn't fix it
Search the full stack trace for the package that calls createHash; a plugin with its own MD4 hashing may need its own upgrade.
When to see a technician
No technician needed; this is a project dependency issue. Ask the project's maintainer if you do not control its dependencies.
Questions people ask
- Is --openssl-legacy-provider safe?
- It is fine for a local build, but it turns on old, weak algorithms for the whole process. Do not set it globally on servers that handle real traffic.
- Why did it start without me changing anything?
- Usually Node.js was updated (by an installer, Homebrew or a CI image) to version 17 or newer, while the project still uses webpack 4.
Sources
- Node.js 17.0.0 release notes (OpenSSL 3.0)
- webpack issue #14532: Node 17 and ERR_OSSL_EVP_UNSUPPORTED