< Back to all hacks

#05 --ignore-scripts (Skip Native Compilation)

Infrastructure
Problem
llama.cpp and other native modules try to compile with gcc/make — impossible on 1 GB RAM ARM32.
Solution
npm install --ignore-scripts skips all native compilation. Use cloud API providers instead of local models.
Lesson
No loss since PocketClaw uses API providers (Kimi, Gemini, Groq) not local inference.

Context

OpenClaw's dependency tree includes several packages with native addons: llama.cpp (local AI inference), sharp (image processing), better-sqlite3 (database), and others. These packages have postinstall scripts that invoke node-gyp, which requires gcc, make, python, and compiles C/C++ code.

On the Moto E2 with 1 GB RAM and a single-core ARM32 CPU, native compilation is not just slow — it's impossible. The compiler runs out of memory within seconds. Even if it could compile, the resulting binaries would be for the proot environment (which emulates armhf), adding another layer of complexity.

Since PocketClaw uses cloud AI providers (Kimi, Gemini, Groq) instead of local models, and the database is file-based JSON, none of these native modules are actually needed at runtime.

Implementation

Use --ignore-scripts during npm install to skip all pre/post install scripts:

# Install OpenClaw without running any native compilation scripts
npm install -g openclaw --ignore-scripts --legacy-peer-deps

The --legacy-peer-deps flag is also needed because several OpenClaw dependencies have conflicting peer dependency requirements (Hack #38).

For a clean reinstall:

# Remove existing installation
rm -rf $PREFIX/lib/node_modules/openclaw

# Reinstall cleanly
npm install -g openclaw --ignore-scripts --legacy-peer-deps

# Verify it installed correctly
openclaw --version

Verification

# Check that openclaw is installed:
ls $PREFIX/lib/node_modules/openclaw/dist/cli.js
# Expected: file exists

# Verify no native modules were compiled:
find $PREFIX/lib/node_modules/openclaw -name "*.node" -type f
# Expected: no output (no compiled .node binaries)

# Test that the gateway starts (native modules not needed):
openclaw gateway run --port 9000 &
sleep 5 && curl -s http://localhost:9000/api/status
# Expected: JSON response

Gotchas

  • --ignore-scripts skips ALL lifecycle scripts, including legitimate setup scripts. Some packages may need manual post-install steps
  • If a required package has a mandatory native addon (not optional), the app will crash at runtime when trying to load the .node binary. Check the error and add ESM stubs (Hack #15) for those modules
  • This flag must be used on every npm install — it's not persisted. You can make it permanent with: npm config set ignore-scripts true
  • Some packages detect missing native modules and fall back to JS implementations automatically (e.g., bcryptbcryptjs)

Result

MetricBeforeAfter
npm install timeFails (OOM)~3 minutes
Native modules compiledAttempted0
Runtime impactN/ANone (cloud API providers)