modules-packagingAnswer last reviewed July 2026

You bump Node to a new major version. What happens to all your native modules?

Strong candidates can explain the ABI boundary, NODE_MODULE_VERSION versus Node-API, and run a Node major upgrade as an inventory and rebuild exercise

What an AI-prepared candidate might say

Native modules are compiled C or C++ that gets loaded into the process, and they're built against a specific Node version's headers. So a major upgrade changes the binary interface, and the compiled addons you already have stop loading, you get a version mismatch error until they're rebuilt. Which means running npm rebuild, or honestly just deleting node_modules and reinstalling. Most of the popular packages avoid the compile step by shipping prebuilt binaries, at install time a helper downloads the binary matching your platform and architecture and Node version. When there's no prebuild it compiles from source with node-gyp, which needs Python and a C++ toolchain lying around. The exception is packages built on N-API, or Node-API I guess it's called now. That interface stays stable across Node versions, so those addons keep working after an upgrade.

Senior
Locked

What a .node file really is under the hood, why the ABI number bumps every major, and how Node-API addons opt out of the entire rebuild cycle.

Unlock the depth
Staff
Locked

The inventory to run before upgrade day, why a lazy require turns a load failure into a request failure, and the Docker layer-cache trap that ships stale binaries.

Unlock the depth
Follow-up chain
You bump Node to a new major version. What happens to all your native modules? | NodeBook