Skip to content

npm launcher rejects Android/Termux: "Unsupported platform: android arm64" #1977

@gtbuchanan

Description

@gtbuchanan

Description

The npm launcher (bin/prek.js) in 0.3.10 rejects Android/Termux with "Unsupported platform: android arm64". The linux-arm64-musl binary runs correctly on Android — only the platform matching is wrong.

The previous installer (0.3.8) used os.type() which returns "Linux" on Android. The 0.3.10 rewrite switched to process.platform (returns "android", not "linux"), which no entry in platforms.json matches.

Follow-up to #1918.

Steps to reproduce

# On Android/Termux (aarch64)
node -e "console.log(process.platform, process.arch)"
# → android arm64

PREK_DEBUG=1 npx @j178/prek@0.3.10 --version
# → [prek-debug] selecting package for platform=android arch=arm64 armVersion=0
# → prek: Unsupported platform: android arm64

Workaround

The linux-arm64-musl binary works. Setting PREK_BINARY bypasses the launcher:

PREK_BINARY=/path/to/prek-linux-arm64-musl/prek prek --version
# → prek 0.3.10

Hook execution also works (stash/unstash, local + remote hooks):

PREK_BINARY=... prek run eslint --all-files
eslint...................................................................Failed
- hook id: eslint
- exit code: 1
- files were modified by this hook

Suggested fix

Add "android" to the os array for the linux-arm64-musl entry in platforms.json:

{
  "rustTarget": "aarch64-unknown-linux-musl",
  "packageName": "@j178/prek-linux-arm64-musl",
  "binaryName": "prek",
  "os": ["linux", "android"],
  "cpu": ["arm64"],
  "libc": "musl"
}

The isMusl() function in bin/prek.js also needs a small adjustment — it returns false early when process.platform !== "linux", so currentLibc() returns null for Android, and the spec.libc filter rejects the musl candidate. Either treat "android" as Linux in isMusl(), or skip the libc filter when the platform is "android" (Bionic is neither glibc nor musl, but the statically-linked musl binary is the correct choice).

Environment

  • Platform: Android 15, Termux (aarch64)
  • Node.js: v24.14.1
  • prek: 0.3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions