node-native-build
Skill2 starsChanged 57 days agoMITView on GitHub
Diagnose npm and Node installs that fail on Termux (node-gyp errors such as android_ndk_path, missing compilers, packages with no android binary, optional platform dependencies, out-of-memory builds) and pick the smallest fix, including WASM fallbacks. Use when npm install, yarn, pnpm, or node-gyp fails, or a package reports an unsupported platform android. Do NOT use for Python builds (see python-native-build) or for JavaScript logic errors.
- Installs packages
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- background-processesSkill
- git-credentialsSkill
- github-actionsSkill
- package-troubleshootingSkill
- proot-boundariesSkill
- python-native-buildSkill
- storage-permissionsSkill
- termux-adbSkill
- termux-apiSkill
- termux-backupSkill
- termux-environmentSkill
- termux-networkSkill
- termux-servicesSkill
- termux-sshdSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Run sh scripts/check-node-toolchain.sh.
- Very specific: line 33
No Android binary exists for a package: prefer its WASM build when one exists (for example the -wasm variants some bundlers and image tools …
- Very specific: line 50
Delete only files created for this attempt (for example ~/.gyp/include.gypi) and npm uninstall only packages added for it.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Node Native Build
Purpose
Tell apart a missing toolchain, a node-gyp configuration problem, and a package that simply ships no binary for Android, then apply the smallest fix.
When to use
npm install,yarn, orpnpmfails while compiling or fetching a native addon.gyp ERR!,Undefined variable android_ndk_path, orUnsupported platform: android.Cannot find module '@scope/pkg-android-arm64'or a similar optional dependency error.
When NOT to use
- Python packages:
python-native-build. - Failures in your own JavaScript.
pkgerrors before npm ran:package-troubleshooting.
Preconditions
Run sh scripts/check-node-toolchain.sh. Capture the first gyp ERR! or build error, the package and version, and whether process.platform reports android (it does on Termux Node).
Decision tree
- The platform string is
android, notlinux. Packages that choose binaries byosandcpumay have no matching optional dependency. Undefined variable android_ndk_path in binding.gyp: node-gyp needs the variable defined. The common fix is a user include file at~/.gyp/include.gypicontaining{'variables': {'android_ndk_path': ''}}. Creating it is a confirmed change. A per-shell alternative isexport GYP_DEFINES="android_ndk_path=''". Cause: Termux's Node reports its OS as android, so node-gyp enables NDK-only branches; upstream node-gyp is addressing it, so a newer node-gyp may not need the workaround.- Missing compiler: node-gyp needs
python,make, andclang(andpkg-configfor some addons) from Termux packages. No module named 'distutils'on newer Python: use a node-gyp version that no longer needs it instead of patching Python.- No Android binary exists for a package: prefer its WASM build when one exists (for example the
-wasmvariants some bundlers and image tools publish), a Termux-packaged equivalent, or proot with glibc. Do not fake the platform. - A build that dies with
Killed: lower parallelism and memory pressure (seebackground-processes), and raiseNODE_OPTIONS=--max-old-space-sizeonly within real device RAM. --ignore-scriptscan confirm that a postinstall step is the failing part, but it leaves the addon unbuilt; say so and do not present it as the fix.- Tools that hard-code
/tmpfail; Termux uses$TMPDIR.
Example
- Situation: npm install fails with Undefined variable android_ndk_path in binding.gyp.
- Without the skill: Fakes the platform string or moves the whole project into proot.
- With the skill: Confirms
python,make, andclangare present, applies the documented fix for the missing variable after confirmation, re-runs the install, and verifies with arequire.
Safety
Installing packages, creating ~/.gyp/include.gypi, and global npm installs change the environment: state the exact change and confirm. Do not run install scripts from packages the user did not choose.
Verification
Re-run the original install, then node -e "require('<package>')" and npm ls <package>.
Rollback
Delete only files created for this attempt (for example ~/.gyp/include.gypi) and npm uninstall only packages added for it.
Handoffs
termux-environmentfor architecture and Android level.package-troubleshootingwhen installing the toolchain fails.background-processeswhen builds are killed.proot-boundarieswhen a glibc-only binary is required.python-native-buildwhen the failing step is a Python dependency of node-gyp.
Report
The first real error, whether it is toolchain, gyp configuration, or missing Android binary, the change applied, and the import check result.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

