The Moto E2 has 4 GB internal storage, of which only ~700 MB is available to Termux after Android's system partition, app data, and Dalvik cache. npm's default cache location is inside Termux's home directory (~/.npm), and installing OpenClaw with all its dependencies generates 500+ MB of cached packages and node_modules.
With the npm cache on internal storage, there's barely enough room for the rootfs, the installed packages, AND the cache. One failed install attempt can fill the disk and leave Termux in an unrecoverable state.
The phone has a 16 GB micro SD card — plenty of space for caching.
Redirect npm's cache to the SD card:
# Point npm cache to SD card
npm config set cache /sdcard/npm-cache
# Create the directory if it doesn't exist
mkdir -p /sdcard/npm-cache
# Verify the setting
npm config get cache
# Expected: /sdcard/npm-cacheFor proot environments, the SD card path is bind-mounted:
# Inside proot, the SD card is accessible at the same path
# Verify access:
ls /sdcard/
# Expected: directory listing of SD card contents
# npm install will now cache to SD card
npm install --ignore-scripts --legacy-peer-deps# Check cache location:
npm config get cache
# Expected: /sdcard/npm-cache
# Check cache size after install:
du -sh /sdcard/npm-cache
# Expected: 200-400 MB depending on packages
# Verify internal storage freed:
df -h /data/data/com.termux/
# Expected: more available space than before.git/objects/ hierarchies will fail with ENAMETOOLONG| Metric | Before | After |
|---|---|---|
| Internal storage used by npm | ~500 MB | ~50 MB |
| Available internal space | ~200 MB | ~650 MB |
| Cache location | ~/.npm (internal) | /sdcard/npm-cache |