How to fix Failed to load config from vite.config.ts: error:0308010C:digital envelope routines::unsupported in React

ReactINTERMEDIATEHIGHUpdated Dec 9, 2025· 176 views

This cryptographic error occurs when using Node.js v17+ with Vite, caused by OpenSSL 3.0 dropping support for legacy hash algorithms like MD4 that older build tools depend on.

Quick fix

Fixes ERR_OSSL_EVP_UNSUPPORTED

export NODE_OPTIONS=--openssl-legacy-provider
npm run dev
  1. Enable OpenSSL legacy provider (Quick fix)
  2. Update Node.js to LTS version with latest patches
  3. Update Vite and build dependencies
  4. Verify Vite configuration format
react — error
export NODE_OPTIONS=--openssl-legacy-provider
npm run dev
Failed to load config from vite.config.ts: error:0308010C:digital envelope routines::unsupported

What this error means

This error appears when Vite attempts to load its configuration file but encounters a cryptographic operation that's no longer supported in modern Node.js versions. Starting with Node.js v17, the runtime switched to OpenSSL 3.0, which removed several legacy cryptographic algorithms including MD4 hashing. The error code "0308010C" specifically indicates that a digital envelope routine (used for encryption/decryption operations) attempted to use an unsupported algorithm. Vite's dependency chain—particularly older versions of webpack or esbuild—may rely on these legacy algorithms for generating build hashes and other cryptographic operations. This is fundamentally a Node.js compatibility issue rather than a Vite bug. The error surfaces during config loading because that's when Vite first invokes these cryptographic operations to process and bundle your configuration file.

Typical symptoms

  • Build fails immediately when running "npm run dev" or "vite"
  • Error message contains "error:0308010C:digital envelope routines"
  • Error occurs after upgrading Node.js to v17 or later
  • Previously working Vite projects suddenly fail to start
  • Stack trace points to vite.config.ts or vite.config.js loading
  • Development server never starts, fails during initialization

Common causes

  1. Using Node.js v17 or later with OpenSSL 3.0 that removed MD4 algorithm support
  2. Outdated build dependencies (webpack, esbuild) that rely on legacy crypto algorithms
  3. Project was created with older tooling and hasn't been updated for Node.js v17+ compatibility
  4. Environment variables or build scripts don't account for OpenSSL changes
  5. Vite configuration uses plugins with outdated cryptographic dependencies

How to fix "Failed to load config from vite.config.ts: error:0308010C:digital envelope routines::unsupported"

1Enable OpenSSL legacy provider (Quick fix)

Set the NODE_OPTIONS environment variable to use the legacy OpenSSL provider:

Linux/macOS:

bash
export NODE_OPTIONS=--openssl-legacy-provider
npm run dev

Windows (Command Prompt):

cmd
set NODE_OPTIONS=--openssl-legacy-provider
npm run dev

Windows (PowerShell):

powershell
$env:NODE_OPTIONS="--openssl-legacy-provider"
npm run dev

Permanent solution in package.json:

json
{
  "scripts": {
    "dev": "NODE_OPTIONS=--openssl-legacy-provider vite",
    "build": "NODE_OPTIONS=--openssl-legacy-provider vite build"
  }
}

For cross-platform compatibility, use the cross-env package:

bash
npm install --save-dev cross-env
json
{
  "scripts": {
    "dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider vite",
    "build": "cross-env NODE_OPTIONS=--openssl-legacy-provider vite build"
  }
}

This re-enables the legacy algorithms that were removed in OpenSSL 3.0.

2Update Node.js to LTS version with latest patches

If you're on Node.js v17 or v18, upgrade to the latest LTS version (Node.js 20+):

bash
# Check current version
node --version

# Using nvm (recommended)
nvm install --lts
nvm use --lts

# Or download from nodejs.org
# https://nodejs.org/

Newer Node.js versions include better compatibility handling and updated build tools have adapted to OpenSSL 3.0 changes.

After upgrading, clean install dependencies:

bash
rm -rf node_modules package-lock.json
npm install
3Update Vite and build dependencies

Upgrade Vite and related build tools to versions that support Node.js v17+:

bash
# Update Vite to latest version
npm install vite@latest --save-dev

# Update all build-related dependencies
npm update esbuild webpack @vitejs/plugin-react

Check your package.json for minimum recommended versions:
- Vite 3.0.0+ (better yet, 4.0.0+)
- esbuild 0.15.0+
- webpack 5.0.0+ (if used)

After updating:

bash
rm -rf node_modules package-lock.json
npm install
npm run dev
4Verify Vite configuration format

Ensure your vite.config.ts uses proper ESM syntax and TypeScript configuration:

typescript
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react()],
});

Check package.json has proper module configuration:

json
{
  "type": "module"
}

If not using "type": "module", rename to vite.config.mts:

bash
mv vite.config.ts vite.config.mts

The .mts extension explicitly marks the file as an ES module.

5Downgrade Node.js to v16 LTS (Temporary workaround)

If you need an immediate fix and can't update dependencies, downgrade to Node.js v16:

bash
# Using nvm
nvm install 16
nvm use 16

# Verify version
node --version  # Should show v16.x.x

# Clean install
rm -rf node_modules package-lock.json
npm install

Warning: Node.js v16 reached end-of-life in September 2023. This is only a temporary solution while you plan to update your dependencies. Do not use this approach for production deployments.

Advanced notes

Understanding OpenSSL 3.0 Changes:

Node.js v17 introduced OpenSSL 3.0, which removed several legacy cryptographic algorithms deemed insecure, including MD4, MD5 (in some contexts), and others. This was a security-focused decision, but it broke backward compatibility with build tools that relied on these algorithms for non-security-critical operations like generating content hashes.

Why --openssl-legacy-provider works:

This flag tells Node.js to load the legacy provider from OpenSSL 3.0, which includes the removed algorithms. While this sounds concerning from a security perspective, these algorithms are only used for build-time operations (file hashing, cache keys) and not for actual cryptographic security in your application. Your production code's security is unaffected.

Production considerations:

If deploying to environments where you control the Node.js version (Docker, serverless functions), ensure your package.json specifies an engine requirement:

json
{
  "engines": {
    "node": ">=20.0.0"
  }
}

Alternative: Use a different bundler:

If Vite continues causing issues, consider alternatives like Turbopack, Rspack, or updating to frameworks with built-in bundlers (Next.js 13+, Remix) that handle these compatibility issues transparently.

CI/CD pipelines:

In GitHub Actions, specify Node.js version explicitly:

yaml
- uses: actions/setup-node@v4
  with:
    node-version: '20'

For Docker builds:

dockerfile
FROM node:20-alpine
ENV NODE_OPTIONS=--openssl-legacy-provider

Frequently asked questions

What does "ERR_OSSL_EVP_UNSUPPORTED" mean?
js versions. 0, which removed several legacy cryptographic algorithms including MD4 hashing. The error code "0308010C" specifically indicates that a digital envelope routine (used for encryption/decryption operations) attempted to use an unsupported algorithm.
How do I fix "ERR_OSSL_EVP_UNSUPPORTED"?
This cryptographic error occurs when using Node.js v17+ with Vite, caused by OpenSSL 3.0 dropping support for legacy hash algorithms like MD4 that older build tools depend on.
What causes "ERR_OSSL_EVP_UNSUPPORTED"?
Using Node.js v17 or later with OpenSSL 3.0 that removed MD4 algorithm support Outdated build dependencies (webpack, esbuild) that rely on legacy crypto algorithms Project was created with older tooling and hasn't been updated for Node.js v17+ compatibility
Is the "ERR_OSSL_EVP_UNSUPPORTED" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading