Cover Image for Fixing Directus 11 Node.js Version Mismatch Error

The Problem

When attempting to start Directus 11 with yarn start, the application fails with the following error:

node:internal/modules/cjs/loader:1651
  return process.dlopen(module, path.toNamespacedPath(filename));

Error: The module '\\?\D:\projects\directus11\node_modules\isolated-vm\out\isolated_vm.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 127. This version of Node.js requires
NODE_MODULE_VERSION 115. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

Root Cause Analysis

This error occurs due to a Node.js version mismatch between:

  • Current Node.js version: v20.19.3 (NODE_MODULE_VERSION 115)

  • Required Node.js version: The isolated-vm module was compiled with NODE_MODULE_VERSION 127, which corresponds to Node.js v22.x

The isolated-vm package is a native Node.js addon that requires compilation for specific Node.js versions. When the Node.js version changes, these native modules must be recompiled or the correct Node.js version must be used.

Why This Happens

  1. Dependencies were installed using Node.js v22.x

  2. The system is now running Node.js v20.19.3

  3. Native modules like isolated-vm are version-specific and cannot run on mismatched Node.js versions


The Solution

You have two main approaches to resolve this issue:

This is the recommended approach as it matches the version used during dependency installation.

Step 1: Install NVM for Windows

  1. Download NVM for Windows from: https://github.com/coreybutler/nvm-windows/releases

  2. Download nvm-setup.exe from the latest release

  3. Run the installer and follow the installation wizard

  4. Close and reopen your PowerShell terminal

Step 2: Install Node.js v22

# List available Node.js versions
nvm list available

# Install Node.js v22 (latest LTS or stable)
nvm install 22

# Use Node.js v22
nvm use 22

# Verify the installation
node --version
# Should output: v22.x.x
# Navigate to your project directory
cd D:\projects\directus11

# Remove existing node_modules and lock files
Remove-Item -Recurse -Force node_modules
Remove-Item -Force yarn.lock

# Reinstall dependencies
yarn install

Step 4: Start Directus

yarn start

✅ Solution 2: Rebuild Native Modules for Node.js v20

If you prefer to stay on Node.js v20, you can rebuild the native modules:

Step 1: Clean and Rebuild

# Navigate to your project directory
cd D:\projects\directus11

# Remove node_modules
Remove-Item -Recurse -Force node_modules

# Clear yarn cache (optional)
yarn cache clean

# Reinstall dependencies
yarn install

# If the issue persists, try rebuilding native modules
yarn rebuild

Step 2: Start Directus

yarn start

Quick Reference: NODE_MODULE_VERSION Mapping

Node.js VersionNODE_MODULE_VERSION
Node.js v18.x108
Node.js v20.x115
Node.js v21.x120
Node.js v22.x127

NVM Commands Cheat Sheet

# List installed Node.js versions
nvm list

# List available Node.js versions for download
nvm list available

# Install a specific Node.js version
nvm install <version>

# Use a specific Node.js version
nvm use <version>

# Set default Node.js version
nvm alias default <version>

# Uninstall a Node.js version
nvm uninstall <version>

# Show current Node.js version
node --version

Troubleshooting

Issue: NVM command not found after installation

Solution: Close and reopen your PowerShell terminal, or restart your computer.

Issue: Permission errors during installation

Solution: Run PowerShell as Administrator:

Start-Process powershell -Verb runAs

Issue: Yarn not found after switching Node.js versions

Solution: Reinstall Yarn globally:

npm install -g yarn

Issue: Still getting the same error after rebuilding

Solution:

  1. Ensure you've completely removed node_modules folder

  2. Delete yarn.lock file

  3. Clear yarn cache: yarn cache clean

  4. Reinstall: yarn install


Additional Notes

  • Directus 11.10.2 is currently installed, but version 11.12.0 is available

  • Consider upgrading Directus after fixing the Node.js version issue:

      yarn add directus@latest
    
  • For production environments, always use the same Node.js version across all systems to avoid native module compatibility issues

  • Consider adding a .nvmrc file to your project root to specify the required Node.js version:

      22
    

  1. ✅ Install NVM for Windows

  2. ✅ Install and switch to Node.js v22

  3. ✅ Verify Node.js version: node --version

  4. ✅ Reinstall dependencies: yarn install

  5. ✅ Start Directus: yarn start

  6. ✅ (Optional) Upgrade Directus to latest version


Created: 2025-10-09
Project: Directus 11
Issue: NODE_MODULE_VERSION mismatch (127 vs 115)
Resolution: Upgrade to Node.js v22 using NVM

Tags

  • #error-fix
  • #directus
  • #nodejs
  • #troubleshooting
  • #nvm