Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

npm run start crashes with ERR_OSSL_EVP_UNSUPPORTED after a Node.js upgrade

ErrorERR_OSSL_EVP_UNSUPPORTED

Short answer

Node.js 17 and newer ship OpenSSL 3, which refuses some old algorithms and key sizes by default. An older build tool or dependency asks for one, so the process dies with ERR_OSSL_EVP_UNSUPPORTED. The quick fix is the --openssl-legacy-provider option. The lasting fix is to upgrade the tool, or to change the hash webpack uses.

  • Applies to Node.js 22, Node.js 24, npm 10, webpack 5.54+
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the Node.js version and find out which webpack version the project resolves. Node.js 17 or newer plus an old webpack points at the causes below.

    node -v
    npm ls webpack
  2. 2Match what you see, then jump to its fix

    1. 1The crash started right after moving from Node.js 16 (or older) to 17 or newer, with no change to the project.A dependency uses an algorithm that OpenSSL 3 blocks by defaultFix
    2. 2npm ls webpack shows a version below 5.54 (webpack 4 inside react-scripts 4 or an old Vue CLI is typical).webpack hashes with md4, its default hash functionFix

What does the error look like?

  • ERR_OSSL_EVP_UNSUPPORTED
  • code: 'ERR_OSSL_EVP_UNSUPPORTED'

Cause 1 of 2

A dependency uses an algorithm that OpenSSL 3 blocks by default

1Check

The Node.js 17 release notes say the error appears when an application or module uses an algorithm or key size that OpenSSL 3.0 no longer allows by default. Run the same command on an older Node.js to see if the error disappears.

node -v
node --openssl-legacy-provider -e "console.log('legacy provider accepted')"

2Fix

As a temporary workaround, switch Node.js back to the legacy provider with --openssl-legacy-provider. The option is on the list of flags that NODE_OPTIONS accepts, so it can be set for npm scripts without editing them. Plan to upgrade the offending tool, since the Node.js notes call this flag temporary.

# macOS / Linux
export NODE_OPTIONS=--openssl-legacy-provider
npm run start

# Windows PowerShell
$env:NODE_OPTIONS = "--openssl-legacy-provider"
npm run start

3Verify

The dev server or build starts without the error.

npm run start

Confirmed by nodejs.org

Did this fix it?

Cause 2 of 2

webpack hashes with md4, its default hash function

1Check

The webpack documentation lists md4 as the default value of output.hashFunction. Find the config that sets, or fails to set, it.

npm ls webpack
grep -rn "hashFunction" webpack.config.js

2Fix

Upgrade webpack, or the framework that bundles it, to a release that supports xxhash64, which webpack added in 5.54.0. If you own the webpack config, set the hash function explicitly.

// webpack.config.js (webpack 5.54 or newer)
module.exports = {
  output: {
    hashFunction: 'xxhash64',
  },
};

3Verify

A clean build finishes without --openssl-legacy-provider set.

unset NODE_OPTIONS
npm run build

Confirmed by webpack.js.org

Did this fix it?

How do I stop it coming back?

  • Pin the Node.js version in the repo (an .nvmrc or the engines field) so a new laptop does not jump versions silently.
  • Upgrade the bundler when you upgrade Node.js, not months later.
  • Treat NODE_OPTIONS=--openssl-legacy-provider as a temporary patch and write down the upgrade it is waiting for.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Back end

ng serve cannot find the dev-server builder package

Could not find the implementation for builder @angular/build:dev-server

The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.