anomalyco / anomalyco/opencode

[FEATURE]: Add android to v2 npm package supported OS for Termux compatibility

Open
#47,612 0 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 6, 2026.

2.0
Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

OpenCode v2 beta (@opencode-ai/cli@beta) works on Termux/Android aarch64 using the existing musl loader, but npm rejects the install because android is not in the package supported OS list.

[!NOTE]
This issue does not exist in v1 — v1 requires a proxy/libresolvefix workaround because of Bun io_uring. v2 replaces Bun with Node.js, eliminating that problem entirely.

Test results

  • Device: Pixel 10 (Android 17, Termux 0.119, aarch64)
  • Package: @opencode-ai/cli-linux-arm64-musl@0.0.0-beta-19192
Command Result
opencode2 --version opencode2 v0.0.0-beta-19192
opencode2 --help Works ✅
Binary dependencies (click to expand)

The v2 musl binary only depends on:

  • libstdc++.so.6
  • libc.musl-aarch64.so.1

No Bun, no JSC, no WebKit — significantly simpler than v1.

Current behavior

npm error code EBADPLATFORM
npm error notsup Unsupported platform for @opencode-ai/cli: wanted {"os":"darwin,linux,win32"} (current: {"os":"android"})

[!TIP]
Workaround:

npm install -g @opencode-ai/cli@beta --force
curl -fsSL https://raw.githubusercontent.com/DEAD1nsane/opencode-termux-musl/master/scripts/fix-opencode2-wrapper.sh | sh

The --force flag bypasses the OS check. The fix script is required because the npm postinstall generates a broken wrapper that execs itself instead of opencode2.exe, causing infinite recursion.

Full install output (click to expand)
$ npm install -g @opencode-ai/cli@beta
npm error code EBADPLATFORM
npm error notsup Unsupported platform for @opencode-ai/cli@0.0.0-beta-19192: wanted {"os":"darwin,linux,win32","cpu":"arm64,x64"} (current: {"os":"android","cpu":"arm64"})
npm error notsup Valid os:   darwin,linux,win32
npm error notsup Actual os:  android

Request

Add android to the supported OS list in the v2 npm package.

[!WARNING]
Without this change, Termux users must use --force to install, which bypasses all platform safety checks. The generated wrapper also has a recursive self-call bug that requires a separate fix script. Both are not discoverable and give a poor first impression.

Why this should be straightforward (click to expand)
  1. The v2 binary is already compiled as linux-arm64-musl — it runs on Android without modification
  2. The postinstall.mjs already handles platform detection via os.platform() which returns "android" on Termux
  3. Adding "android" to the os field in package.json is a one-line change
  4. No code changes needed — the binary works as-is
Wrapper bug details (click to expand)

The npm postinstall generates a shell wrapper at $PREFIX/bin/opencode2 that contains:

exec "$PREFIX/lib/node_modules/@opencode-ai/cli/bin/opencode2" "$@"

This execs the wrapper script itself (infinite recursion), not the actual binary (opencode2.exe). Additionally, the wrapper:

  • Unnecessarily starts the Python HTTP proxy (v2 is Node.js-based, doesn't need it)
  • Sets HTTP_PROXY/HTTPS_PROXY which v2 doesn't need

The fix script (fix-opencode2-wrapper.sh) patches the ELF interpreter (binary expects /lib/ld-musl-aarch64.so.1 but Termux installs at $PREFIX/lib/) and creates a correct wrapper.

If this issue is resolved (adding android to supported OS), the postinstall.mjs should also be updated to generate a correct wrapper on Android.

Related

  • #11689 — v1 feature request for Android binary (closed)
  • #12515 — v1 postinstall fails with missing opencode-android-arm64 (closed)
  • guysoft/opencode-termux — community v1 cross-compile project
  • DEAD1nsane/opencode-termux-musl — musl loader approach for v1 + v2 wrapper fix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.