How to fix Error: Module version mismatch. Expected 93, got 94. in Node.js

Node.jsBEGINNERMEDIUMUpdated Dec 9, 2025· 216 views

This error occurs when native Node.js modules are compiled for one Node.js version but run with a different version. The version numbers (e.g., 93 vs 94) represent the NODE_MODULE_VERSION ABI used by different Node.js releases.

Quick fix

Fixes MODULE_VERSION_MISMATCH

node --version
  1. Verify your current Node.js version
  2. Rebuild all native modules for your current Node.js version
  3. Delete node_modules and reinstall dependencies
  4. Standardize Node.js version across all environments
node.js — error
node --version
Error: Module version mismatch. Expected 93, got 94.

What this error means

The "Module version mismatch" error indicates that a native addon or module (typically written in C/C++) was compiled against a specific version of Node.js's Application Binary Interface (ABI), but is now being loaded by a different version of Node.js with an incompatible ABI. Each Node.js version has an associated MODULE_VERSION number that represents its ABI. For example, Node.js 16.x uses version 93, Node.js 17.x uses version 102, and Node.js 18.x uses version 108. When you see "Expected 93, got 94," it means a native module was compiled for one version but is being used with another. Native modules contain compiled binary code that directly interfaces with Node.js internals. Unlike pure JavaScript modules, they must be recompiled whenever the underlying Node.js version changes significantly. This error most commonly occurs in CI/CD pipelines, Docker containers, or when switching Node.js versions locally without rebuilding dependencies.

Typical symptoms

  • Application crashes immediately on startup with module version error
  • Error mentions specific MODULE_VERSION numbers (e.g., "Expected 93, got 94")
  • Native modules like bcrypt, canvas, sqlite3, or sharp fail to load
  • Works fine in development but fails in production or CI/CD
  • Error occurs after upgrading or switching Node.js versions
  • Electron apps fail to load native Node.js modules

Common causes

  1. Node.js version differs between development and production environments
  2. Dependencies were installed with one Node.js version but app runs with another
  3. Docker image uses different Node.js version than local development
  4. CI/CD pipeline uses cached node_modules from different Node.js version
  5. Using pre-built binaries that don't match your Node.js version
  6. Electron app using Node.js modules compiled for standard Node.js runtime
  7. Switching Node.js versions locally without rebuilding native modules

How to fix "Error: Module version mismatch. Expected 93, got 94."

1Verify your current Node.js version

First, check which Node.js version you're actually running:

bash
node --version

Also check which version your package.json or .nvmrc specifies, and ensure they match across all environments (development, CI/CD, production).

2Rebuild all native modules for your current Node.js version

The quickest fix is to rebuild all native modules against your current Node.js version:

bash
npm rebuild

This recompiles all native addons in your node_modules folder. For yarn users:

bash
yarn install --force

For pnpm users:

bash
pnpm rebuild
3Delete node_modules and reinstall dependencies

If rebuilding doesn't work, perform a clean reinstall:

bash
# Remove existing dependencies
rm -rf node_modules
rm -f package-lock.json  # or yarn.lock or pnpm-lock.yaml

# Clear npm cache
npm cache clean --force

# Reinstall
npm install

On Windows:

powershell
rd /s /q "node_modules"
del package-lock.json
npm cache clean --force
npm install

This ensures all modules, including native addons, are compiled fresh for your current Node.js version.

4Standardize Node.js version across all environments

Ensure consistent Node.js versions everywhere:

Using .nvmrc:

bash
# Create .nvmrc file
echo "18.17.0" > .nvmrc

# Use it with nvm
nvm use

In package.json:

json
{
  "engines": {
    "node": ">=18.17.0 <19.0.0"
  }
}

In Dockerfile:

dockerfile
FROM node:18.17.0-alpine

In CI/CD (GitHub Actions example):

yaml
- uses: actions/setup-node@v3
  with:
    node-version: '18.17.0'

Update all environments to use the same Node.js version, then rebuild your dependencies.

5For Electron apps: Use electron-rebuild

Electron requires special handling because it uses a different V8 version than standard Node.js:

bash
# Install electron-rebuild
npm install --save-dev @electron/rebuild

# Rebuild for Electron
npx electron-rebuild

Or add it as a postinstall script in package.json:

json
{
  "scripts": {
    "postinstall": "electron-rebuild"
  }
}

This recompiles native modules specifically for Electron's Node.js environment.

6Check for platform-specific pre-built binaries

Some packages (like sharp, canvas, or sqlite3) provide pre-built binaries. Ensure you're downloading the correct ones:

bash
# Force download of pre-built binaries
npm install --force

# Or for specific packages
npm rebuild sharp --verbose

If pre-built binaries aren't available for your Node.js version, the package will compile from source, which requires build tools (python, make, g++/clang) to be installed.

Advanced notes

MODULE_VERSION reference table:

| Node.js Version | MODULE_VERSION |
|-----------------|----------------|
| 14.x | 83 |
| 15.x | 88 |
| 16.x | 93 |
| 17.x | 102 |
| 18.x | 108 |
| 19.x | 111 |
| 20.x | 115 |
| 21.x | 120 |

Build requirements for native modules:

To compile native modules from source, you need platform-specific build tools:

- Linux: build-essential, python3
- macOS: Xcode Command Line Tools (xcode-select --install)
- Windows: Visual Studio Build Tools or windows-build-tools npm package

Docker considerations:

When using Docker, the Node.js version in your Dockerfile must match your development environment. Use multi-stage builds to ensure consistency:

dockerfile
FROM node:18.17.0-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .

FROM node:18.17.0-alpine
WORKDIR /app
COPY --from=builder /app .
CMD ["node", "index.js"]

CI/CD caching gotchas:

Many CI systems cache node_modules to speed up builds. If you change Node.js versions, you must invalidate this cache:

yaml
# GitHub Actions example
- name: Cache node modules
  uses: actions/cache@v3
  with:
    path: node_modules
    key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}-${{ matrix.node-version }}

Note the matrix.node-version in the cache key—this ensures separate caches per Node.js version.

Debugging which module is causing the error:

If the error message doesn't specify which module is problematic, enable verbose logging:

bash
NODE_DEBUG=module node index.js

Or check the stack trace carefully—the first native module in the trace is likely the culprit.

Frequently asked questions

What does "MODULE_VERSION_MISMATCH" mean?
js with an incompatible ABI. js version has an associated MODULE_VERSION number that represents its ABI. x uses version 108.
How do I fix "MODULE_VERSION_MISMATCH"?
This error occurs when native Node.js modules are compiled for one Node.js version but run with a different version. The version numbers (e.g., 93 vs 94) represent the NODE_MODULE_VERSION ABI used by different Node.js releases.
What causes "MODULE_VERSION_MISMATCH"?
Node.js version differs between development and production environments Dependencies were installed with one Node.js version but app runs with another Docker image uses different Node.js version than local development
Is the "MODULE_VERSION_MISMATCH" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading