opencode icon indicating copy to clipboard operation
opencode copied to clipboard

YOLO script not helpful in Termux

Open Huge opened this issue 1 year ago • 14 comments

...
Successfully added opencode to $PATH in /data/data/com.termux/files/home/.bashrc
12:48:51 u0_a338@localhost ~ → opencode
No command opencode found, did you mean:
 Command qrencode in package libqrencode
 Command uuencode in package sharutils
12:49:31 u0_a338@localhost ~ → source .bas
.bash_history  .bash_profile  .bashrc
12:49:31 u0_a338@localhost ~ → source .bashrc
12:49:58 u0_a338@localhost ~ → opencode
bash: /data/data/com.termux/files/home/.opencode/bin/opencode: cannot execute: required file not found

After the last error I have no idea for a fix, at least a more specific error message would help.

Huge avatar Jul 05 '25 10:07 Huge

does ~/.opencode exist?

thdxr avatar Jul 05 '25 14:07 thdxr

The file exists but I assume it's the wrong architecture and that error results in a slightly misleading / incorrect error message of file does not exist.

MatthewScholefield avatar Jul 13 '25 05:07 MatthewScholefield

I think it's maybe another linked file, the file itself is there but throws the error message

keeganmccallum avatar Jul 14 '25 06:07 keeganmccallum

does ~/.opencode exist?

As Callum has said, yes it exists. I'm curious about the

required file not found

if it is part of this repository, I've not found it.

Huge avatar Jul 16 '25 13:07 Huge

i'm not too sure - not exactly easy for me to reproduce this so would need someone who has the issue to do some digging

thdxr avatar Jul 16 '25 19:07 thdxr

Bu sorunu çözebilecek bir yok mu

alkadras avatar Jul 17 '25 10:07 alkadras

I reproduced this when I tried to install in an Alpine container running on macOS. It installed the arm64 binary (which matches the host machine, not the container, which is running through Rosetta). I have no idea if this is something the package maintainer needs to fix in the metadata or if this is something that doesn't work in npm/pnpm. But the issue is definitely what was suggested, wrong architecture

tspader avatar Aug 03 '25 05:08 tspader

I just tried this, same issue

filip-risteski avatar Sep 12 '25 13:09 filip-risteski

@Huge I experienced the same issue, which I believe was due to how Termux represents Android. Switching to a proot distribution (Debian, in my case) resolved it, and I can now work without problems.

code-with-nex avatar Sep 30 '25 19:09 code-with-nex

Your architecture (this is the real issue)

uname -m

Output: aarch64 (Android ARM64)

What the npm package expects

- opencode-linux-x64 (Linux, 64-bit Intel)

- opencode-darwin-x64 (macOS, Intel)

- opencode-darwin-arm64 (macOS, Apple Silicon)

- opencode-android-arm64 ❌ (Missing - this is what you need!)

pobeda1 avatar Oct 12 '25 23:10 pobeda1

Bun on Termux · Issue #8685 · oven-sh/bun https://github.com/oven-sh/bun/issues/8685

Maybe this thing affects. Because can't run bun too.

pobeda1 avatar Oct 13 '25 01:10 pobeda1

I'm able to run opencode from flake on nix-on-droid (nix enabled fork of Termux) without root. If this is still not working for you, you can try this.

honzakostejn avatar Nov 07 '25 14:11 honzakostejn

On termux I think this is the problem: /data/data/com.termux/files/home/.opencode/bin/opencode: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=61c89cbce93de43843a486719fdbfd10f711c71d, not stripped

Termux uses Bionic libc not glibc

Steven-Martin-CC avatar Nov 29 '25 21:11 Steven-Martin-CC

❯ ls .opencode
bin
❯ ls .opencode/bin
opencode
❯ ~/.opencode/bin/opencode --version
zsh: no such file or directory: /data/data/com.termux/files/home/.opencode/bin/opencode
❯ ~/.opencode/bin/opencode --version
zsh: no such file or directory: /data/data/com.termux/files/home/.opencode/bin/opencode
❯ source .zshrc
❯ ~/.opencode/bin/opencode --version
zsh: no such file or directory: /data/data/com.termux/files/home/.opencode/bin/opencode
❯ patchelf --set-interpreter $PREFIX/lib/ld-android.so ~/.opencode/bin/opencode


❯
❯ ~/.opencode/bin/opencode --version                       zsh: no such file or directory: /data/data/com.termux/files/home/.opencode/bin/opencode
❯ npm install -g opencode-ai@latest

npm error code EBADPLATFORM
npm error notsup Unsupported platform for [email protected]: 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
npm error notsup Valid cpu:  arm64,x64
npm error notsup Actual cpu: arm64
npm error A complete log of this run can be found in: /data/data/com.termux/files/home/.npm/_logs/2026-06-17T14_31_51_276Z-debug-0.log
❯ npm install -g opencode-ai@latest --ignore-scripts --force

npm warn using --force Recommended protections disabled.

added 1 package in 24s
❯ opencode --version

Error: opencode-ai's postinstall script was not run.

This occurs when using --ignore-scripts during installation, or when using a
package manager like pnpm that does not run postinstall scripts by default.

To fix this, run the postinstall script manually:
  cd node_modules/opencode-ai && node postinstall.mjs

Or reinstall opencode-ai without the --ignore-scripts flag.
❯ cd node_modules/opencode-ai && node postinstall.mjs
cd: no such file or directory: node_modules/opencode-ai
❯ cd ~/node_modules/opencode-ai && node postinstall.mjs
cd: no such file or directory: /data/data/com.termux/files/home/node_modules/opencode-ai
❯ cd $PREFIX/lib/node_modules/opencode-ai

❯ node postinstall.mjs                                     
It seems your package manager failed to install the right opencode CLI package. Try manually installing "opencode-android-arm64".
❯ npm install -g opencode-android-arm64                    npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/opencode-android-arm64 - Not found
npm error 404
npm error 404  The requested resource 'opencode-android-arm64@*' could not be found or you do not have permission to access it.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: /data/data/com.termux/files/home/.npm/_logs/2026-06-17T14_42_20_410Z-debug-0.log
/data/data/com.termux/files/usr/lib/node_modules/opencode-ai 6s ❯                                            07:42:25

timerloggedout-spec avatar Jun 17 '26 14:06 timerloggedout-spec