Skip to content

npm/npx broken after install — /usr/bin/env: bad interpreter error #49

@kuniakil

Description

@kuniakil

npm/npx broken after install — /usr/bin/env: bad interpreter error

Hi, I installed openclaw-android following the README on a fresh Android phone using Termux.

After installation, npm and npx cannot be executed by OpenClaw. The error in the gateway log is:

exec failed: /data/data/com.termux/files/home/.openclaw-android/node/bin/npx
/data/data/com.termux/files/usr/bin/bash: .../node/bin/npx: /usr/bin/env: bad interpreter: No such file or directory

The cause is that the shebang line in npm and npx is #!/usr/bin/env node, but /usr/bin/env does not exist in Termux. The correct path in Termux is /data/data/com.termux/files/usr/bin/env.

I was able to fix it manually with:

sed -i '1s|#!/usr/bin/env node|#!/data/data/com.termux/files/home/.openclaw-android/node/bin/node|' ~/.openclaw-android/node/bin/npm
sed -i '1s|#!/usr/bin/env node|#!/data/data/com.termux/files/home/.openclaw-android/node/bin/node|' ~/.openclaw-android/node/bin/npx

However, this fix is lost every time Node.js is reinstalled by oa --update.

Could this shebang patch be added to install-nodejs.sh, similar to how other Linux paths like /bin/sh and /usr/bin/env are already patched elsewhere in the project?

Environment:

  • Device: Android (Termux)
  • Architecture: aarch64 / glibc
  • Node.js: v22.22.0
  • openclaw-android: latest (oa --update applied)

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