Native Module Build Fails on Shared Hosting (node-gyp, Old glibc/Python): The .npmrc Fix

TL;DR — Deploying to shared hosting failed during npm install while a native addon (better-sqlite3) tried to compile via node-gyp, tripping over the host's old glibc/Python toolchain — neither of which can be upgraded on shared hosting. The actual fix was realizing the native module wasn't even needed at runtime anymore, and skipping its build step entirely.
Table of Contents
Symptom
Install fails specifically inside the native module's own postinstall build step — a node-gyp/compiler error tied to the host's old system Python/glibc versions, not a normal dependency-resolution failure.
Root cause
Shared hosting gives no control over the system Python/compiler toolchain node-gyp needs to compile a native addon. In this project, the database adapter had already moved to a different backend (Turso/libsql, then Postgres) at runtime — so the native SQLite binding wasn't actually load-bearing anymore, just still listed as a dependency whose build script fires on every install.
Fix
.npmrc
ignore-scripts=trueThis skips all install-time build scripts, including the native compile step — safe here specifically because nothing at runtime still depends on that native binary.
Lessons learned
- ignore-scripts=true skips every package's install scripts, not just the offending one — audit what's actually installed and confirm nothing else's postinstall step is load-bearing before reaching for this.
- When migrating a database adapter, remember to also drop (or at least stop needing) the old adapter's native dependency — it can keep silently causing deploy failures long after the code stopped using it.



Comments