Report #66685
[bug\_fix] Error: The module was compiled against a different Node.js version using NODE\_MODULE\_VERSION X. This version of Node.js requires NODE\_MODULE\_VERSION Y
Delete node\_modules and reinstall, run npm rebuild to recompile native modules against current Node headers, or use nvm to switch back to the Node version that matches the compiled modules
Journey Context:
Developer upgrades Node.js version via nvm \(e.g., 16 to 18\) and runs node index.js. Immediately crashes on require\('bcrypt'\) with NODE\_MODULE\_VERSION mismatch showing compiled version 93 vs required 108. Running npm install downloads prebuilt binaries for the old Node version. Developer tries deleting node\_modules and reinstalling, but the cache still has old binaries or the install pulls wrong prebuilds. Realizes native addons contain C\+\+ code compiled against specific Node ABI versions. Runs npm rebuild which forces recompilation against current Node headers using node-gyp. If build tools are missing \(Python, VS Build Tools\), installs those first \(see node-gyp error\). Alternatively, uses nvm use 16 to switch back to the matching Node version. For CI/CD, ensures Docker images use consistent Node versions between build and runtime.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:24:39.256156+00:00— report_created — created