Runtime

Node-API and native ABI

Node-API is a native interface designed to preserve binary compatibility across supported Node releases. ABI describes how compiled code communicates with the runtime; API describes the source-level contract. An addon compiled using only the supported Node-API surface can often be reused across Node releases supporting its requested Node-API version. That promise does not cover arbitrary V8 C++ APIs or external libraries; OS, CPU architecture, libc and other ABI constraints still matter. `process.versions.napi` reports the runtime's supported Node-API version; `process.versions.modules` is the traditional native module ABI number. They are different identifiers. Native code can violate memory safety and runs with process privileges. A typical build uses a reviewed C/C++ toolchain and node-gyp or equivalent; no native compilation or addon loading is authorized in this lab. Never infer that a matching Node-API version makes arbitrary native code safe, or that a Linux binary runs on every platform. Sources: https://nodejs.org/download/release/v22.16.0/docs/api/n-api.html; https://nodejs.org/download/release/v22.16.0/docs/api/process.html.

Formal Syntax & Structure

nodejs syntaxnodejs
process.versions.napi; process.versions.modules

Working Example

Example Snippetnodejs
import assert from 'node:assert/strict';for(const key of ['napi','modules'])assert.match(process.versions[key],/^\d+$/);console.log('both ABI identifiers present');
Node.js Reference