Add WebAssembly support for image reading in Termux/Android environments

Resolved 💬 5 comments Opened Jun 18, 2025 by kazuph Closed Dec 10, 2025

Add WebAssembly support for image reading in Termux/Android environments

Description

Claude Code currently fails to read images in Termux (Android terminal) environments due to missing native sharp binaries for the android-arm64 platform.

Error Message

Error: Could not load the "sharp" module using the android-arm64 runtime

Solution Discovered

I've successfully made Claude Code work on Termux by simply adding WebAssembly version of sharp:

npm install @img/sharp-wasm32 --force
npm install sharp --force

After this modification, image reading works perfectly:

echo "What do you see?" | node cli.js image.png
# Output: "I see a bright red square image..."

Proposed Fix

Add @img/sharp-wasm32 to optionalDependencies in package.json:

{
  "optionalDependencies": {
    "@img/sharp-darwin-arm64": "^0.33.5",
    "@img/sharp-darwin-x64": "^0.33.5",
    "@img/sharp-linux-arm": "^0.33.5",
    "@img/sharp-linux-arm64": "^0.33.5",
    "@img/sharp-linux-x64": "^0.33.5",
    "@img/sharp-win32-x64": "^0.33.5",
    "@img/sharp-wasm32": "^0.33.5"  // ← Add this line
  }
}

Environment Details

  • Platform: Termux on Android
  • Node.js: v24.2.0
  • Process.platform: android
  • Process.arch: arm64
  • Claude Code: v1.0.27

Performance

WebAssembly version shows excellent performance:

  • Image processing: ~12ms per image
  • All formats supported (PNG, JPEG, etc.)
  • No functionality loss compared to native version

Benefits

  1. Enables Claude Code on Android/Termux environments
  2. No code changes required (only dependency addition)
  3. Minimal package size increase
  4. WebAssembly serves as universal fallback for unsupported platforms

Would you consider adding WebAssembly sharp support for better platform compatibility?

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗