Introducing Livops 2.0! Promo codeCEOgives you 8,000 so‘m on your balance.What’s new

Error: error:0308010C:digital envelope routines::unsupported (ERR_OSSL_EVP_UNSUPPORTED): how to fix it

Error: error:0308010C:digital envelope routines::unsupported with code ERR_OSSL_EVP_UNSUPPORTED means an old build tool, usually webpack 4 inside an old Create React App, Vue CLI or Next.js, asked Node.js 17 or later for the md4 hash, which OpenSSL 3 no longer allows by default. Upgrade the build tool (webpack 5.61 or later, react-scripts 5); NODE_OPTIONS=--openssl-legacy-provider is only a stopgap.

By Livops team, the people who build and run LivopsUpdated

The error people search for, as Node.js 17 and later print it when an old webpack builds (shortened; paths and line numbers vary):

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:103:19)
    at Object.createHash (node:crypto:146:10)
    at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
  ...
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

It usually appears in npm run build or npm start of a project that built fine for years: a Create React App on react-scripts 4, a Vue CLI 4 app, an old Next.js. Nothing in your code changed; the Node.js version under it did. This page explains why, gives the fixes from the lasting one to the stopgap, and says how it looks on Livops.

What does the error mean?

Node.js 17 moved to OpenSSL 3.0, which tightened which algorithms and key sizes are allowed by default[1]. The Node.js release notes name this exact code: if you hit ERR_OSSL_EVP_UNSUPPORTED on Node.js 17, your application or a module it uses is asking for an algorithm OpenSSL 3.0 no longer allows by default[1].

The algorithm here is md4. OpenSSL 3 keeps it in its legacy provider, with algorithms that have fallen out of use or are considered insecure[2]. webpack 4 hashes modules with md4, so on Node.js 17 or later the build stops at the first hash; webpack 4.47.0 later added md4 support for Node.js 18 and later for exactly this reason[5]. webpack fixed this in 5.61.0 with its own WebAssembly md4 “for node 17 support”[3], so it no longer asks OpenSSL for it.

The stack trace says who asked: the first path under node_modules is the package to upgrade. Most of the time it is webpack/lib/util/createHash.js.

Fixes, best first

1. Upgrade webpack to a current 5.x

If the project uses webpack directly, move to webpack 5, at 5.61.0 or later[3]:

npm ls webpack                  # which webpack actually runs, and who brought it
npm install --save-dev webpack@5 webpack-cli@latest

webpack 4 to 5 is a major upgrade with breaking changes, so build locally before you push. If npm ls shows a webpack 5 older than 5.61.0, updating it within 5.x is enough. From 5.54.0, output.hashFunction: "xxhash64" also moves every hash to a WebAssembly function[4]:

// webpack.config.js
module.exports = {
  output: { hashFunction: "xxhash64" },
};

If you must stay on webpack 4 for now, update it within 4.x: 4.47.0 added md4 support for Node.js 18 and later[5].

2. Create React App: upgrade react-scripts to 5

react-scripts 4.0.3 pins webpack 4.44.2 exactly[6], so updating webpack alone is not possible there. react-scripts 5 moved to webpack 5[8], and 5.0.1 asks for ^5.64.4[7], past the fix. The changelog gives the upgrade command[8]:

npm install --save --save-exact [email protected]
npm run build

Version 5 has its own breaking changes (it dropped Node 10 and 12, among others)[8], so read the build output before you push. Also know that the React team deprecated Create React App for new apps in February 2025: existing apps keep working in maintenance mode, and the recommendation is to move to a framework or to a build tool such as Vite, Parcel or Rsbuild[9].

3. Vue CLI and Next.js: upgrade the framework

  • Vue CLI 4 builds with webpack 4; Vue CLI 5 upgraded to webpack 5[10]. In the project, run vue upgrade and follow its prompts[10]. Vue CLI itself is in maintenance mode, and create-vue (Vite) is recommended for new projects[10].
  • Next.js made webpack 5 the default for all apps in Next.js 11[11]. An app on Next.js 10 or older should move to a current Next.js.

4. Stopgap: NODE_OPTIONS=–openssl-legacy-provider

--openssl-legacy-provider enables OpenSSL 3.0’s legacy provider[12], which brings md4 back. Node.js added it as a temporary workaround, not a fix[1]. It is allowed in NODE_OPTIONS[12], so you can set it for the build without touching the code:

NODE_OPTIONS=--openssl-legacy-provider npm run build

Or in package.json, for one script only:

"scripts": {
  "build": "NODE_OPTIONS=--openssl-legacy-provider react-scripts build"
}

NODE_OPTIONS is a space-separated list[12]. If it already has a value, such as a memory limit, keep both: NODE_OPTIONS="--max-old-space-size=2048 --openssl-legacy-provider". Treat this as a way to get today’s deploy out, and plan the upgrade.

5. Why not go back to Node 16?

The error appears from Node.js 17, so an older Node builds without it, but that means Node 16, and Node.js marks 16, 18 and 20 all as end-of-life[13]. The Node.js project says production apps should use only Active LTS or Maintenance LTS releases[13]; the lines it lists as LTS today are 22 and 24[13]. An EOL Node gets no security fixes, which is a worse trade than a legacy hash in a build step. Keep a current Node and fix the build tool.

How to confirm the fix locally

Build with the same Node major as the server, from a clean install:

node -v                    # must be the server's major, for example v22 or v24
rm -rf node_modules
npm ci
npm run build

To be sure you are testing the server’s Node and not yours, run it in a container:

docker run --rm -v "$PWD":/app -w /app node:22 sh -c "npm ci && npm run build"

If you used the stopgap, run this once without NODE_OPTIONS as well: when that passes too, the flag can go.

On Livops

  • Detected as usual. Create React App and Vue CLI are among the frameworks Livops detects; it then sets the install, build and start commands, and you can change them in the cabinet or in livops.json.

  • Node 22 and 24. Those are the Node versions Livops builds with. Both come long after Node 17, so an old webpack fails on either, and going back to Node 16 is not an option here. Livops reads .nvmrc and .node-version.

  • The stopgap, without a commit. Variables you add in Settings → Variables reach the build; that is how Livops’s docs set NODE_OPTIONS for a build that runs out of memory. Add:

    NODE_OPTIONS=--openssl-legacy-provider

    If NODE_OPTIONS is already there, put both flags in one value, separated by a space. You can also change the build command itself in Settings → Build, or with build in livops.json:

    {
      "build": "NODE_OPTIONS=--openssl-legacy-provider npm run build"
    }
  • When it fails, the deploy stops as build_failed and the previous version keeps running. Next to the failed build, the assistant’s button reads the log and explains what happened. See Build failed.

Other build failures, where the real error sits above code 1, are in npm error code 1. If the build passes and the app then stops with Cannot find module, see Error: Cannot find module.

Questions

What does error:0308010C digital envelope routines unsupported mean?

Your build asked Node.js for a hash algorithm that OpenSSL 3 does not allow by default. In almost every report it is webpack 4 asking for md4. Node.js 17 and later ship OpenSSL 3, so the same project that built on Node 16 stops here.

Is NODE_OPTIONS=--openssl-legacy-provider safe to use?

It works, and Node.js itself calls it a temporary workaround. It turns the old algorithms back on for the whole process, and an old webpack also means old loaders and old security fixes. Use it to get a deploy out today, then upgrade the build tool.

Should I downgrade to Node 16?

No. Node.js 16 is end-of-life, and so are 18 and 20. The Node.js project says production apps should run only LTS releases, which today are 22 and 24. Fix the build tool instead.

I am already on webpack 5. Why do I still get it?

webpack 5 got its own md4 only in 5.61.0; earlier 5.x releases still ask OpenSSL for it. Run npm ls webpack: an old copy pulled in by a plugin or by an outdated framework can still be the one that runs. Update it to a current 5.x.

Does react-scripts 5 fix it?

Yes. react-scripts 5 moved Create React App to webpack 5, at a version past the fix. The upgrade has its own breaking changes, so build locally before you push. Create React App itself is deprecated for new apps, so a move to Vite or a framework is worth planning.

How do I see which package calls the hash?

Read the stack trace under the error. The first path inside node_modules, often webpack/lib/util/createHash.js, names the package. If it is a loader or plugin rather than webpack, update that package.

Sources

  1. Node.js — Node v17.0.0 (Current) release notes (nodejs.org). Checked .
  2. OpenSSL 3.0 — OSSL_PROVIDER-legacy (docs.openssl.org). Checked .
  3. webpack — v5.61.0 release notes (github.com). Checked .
  4. webpack — v5.54.0 release notes (github.com). Checked .
  5. webpack — v4.47.0 release notes (github.com). Checked .
  6. Create React App — react-scripts 4.0.3 package.json (raw.githubusercontent.com). Checked .
  7. Create React App — react-scripts 5.0.1 package.json (raw.githubusercontent.com). Checked .
  8. Create React App — CHANGELOG (github.com). Checked .
  9. React Blog — Sunsetting Create React App (react.dev). Checked .
  10. Vue CLI — Migrating from v4 (cli.vuejs.org). Checked .
  11. Next.js Blog — Next.js 11 (nextjs.org). Checked .
  12. Node.js Docs — Command-line API (nodejs.org). Checked .
  13. Node.js — Previous releases (nodejs.org). Checked .

Put your project online today

Connect GitHub or drop a folder. No card is asked for.

Deploy your Node app

Got a question? — @livops_uz