Node native addon "node-gyp rebuild" Fails at Runtime in CI - Fix the Build
When a native addon has no prebuilt binary for the runner, node-gyp compiles it from source. Missing compilers or Python on the runner make that rebuild fail.
What this error means
A step that loads or rebuilds a native addon fails with node-gyp errors about a missing compiler, missing Python, or an ABI mismatch, aborting the job.
node
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! System Linux 6.2.0
npm ERR! code 1
npm ERR! command failed: node-gyp rebuildCommon causes
The runner lacks a C/C++ toolchain or Python
node-gyp needs make, a compiler, and Python; a minimal runner image may not have them.
No prebuilt binary for this Node ABI
The addon ships prebuilds for some Node versions but not the one on the runner, forcing a from-source rebuild.
How to fix it
Install the build toolchain
- Install build-essential and Python on the runner before the addon build.
- Re-run so node-gyp can compile.
GitHub Actions
- run: sudo apt-get update && sudo apt-get install -y build-essential python3Pin a Node version with a matching prebuild
- Choose a Node version the addon ships a prebuilt binary for.
- Re-run so no from-source build is needed.
How to prevent it
- Use runner images that include the build toolchain, pin Node to a version with available prebuilds, and cache compiled addons keyed on the Node ABI.
Related guides
Node "Segmentation fault" from a Native Addon in CI - Diagnose the CrashFix Node.js segmentation faults from a native addon in CI by rebuilding the addon for the runner, upgrading i…
Node native addon dlopen Fails at Runtime in CI - Fix the ABI MismatchFix Node.js native addon dlopen failures at runtime in CI by rebuilding the addon against the runner Node ver…
Node "The engine 'node' is incompatible" at Runtime in CI - Align Node VersionsFix the "engine node is incompatible" error in CI by pinning the CI Node version to satisfy the engines field…