How can i solve code-server runtime error in termux app on android?

5.2k views Asked by At

https://github.com/cdr/code-server/discussions/2157

Screenshot1

i am beginner I don't have pc so i want run vscode in android (termux app) Please some help.......

I had download https://github.com/cdr/code-server/releases/download/v3.5.0/code-server-3.5.0-linux-arm64.tar.gz

With reference https://medium.com/samsung-internet-dev/developing-on-android-phones-visual-studio-code-on-dex-4c99d2e80e91

To this blog Please someone suggestion...

--------------------------------------------------------------------------

Thank you for great suggestion @MorrisonChang It's almost work (image below)

Screenshot2

BUT when i opened browser (image below)

Screenshot3

And error occurs "Error: Could not locate the bindings file. Tried:" (Description below)

$ code-server
[2020-10-07T05:24:03.991Z] info  Using config file ~/.config/code-server/config.yaml
[2020-10-07T05:24:06.342Z] info  Using user-data-dir ~/.local/share/code-server
[2020-10-07T05:24:06.391Z] info  code-server 3.5.0 de41646fc402b968ca6d555fdf2da7de9554d28a
[2020-10-07T05:24:06.428Z] info  HTTP server listening on http://127.0.0.1:8080
[2020-10-07T05:24:06.429Z] info      - Using password from ~/.config/code-server/config.yaml
[2020-10-07T05:24:06.430Z] info      - To disable use `--auth none`
[2020-10-07T05:24:06.430Z] info    - Not serving HTTPS                                          Error: Could not locate the bindings file. Tried:
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/build/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/build/Debug/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/build/Release/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/out/Debug/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/Debug/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/out/Release/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/Release/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/build/default/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/compiled/14.8.0/android/arm/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/addon-build/release/install-root/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/addon-build/debug/install-root/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/addon-build/default/install-root/spdlog.node
 → /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/lib/binding/node-v83-android-arm/spdlog.node
    at bindings (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/index.js:3:35)
    at Module._compile (internal/modules/cjs/loader.js:1251:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10)
    at Module.load (internal/modules/cjs/loader.js:1100:32)
    at Function.Module._load (internal/modules/cjs/loader.js:962:14)
    at Module.require (internal/modules/cjs/loader.js:1140:19)
    at Module.patchedRequire [as require] (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/diagnostic-channel/dist/src/patchRequire.js:14:46)
    at require (internal/modules/cjs/helpers.js:75:18)
    at t.load (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:16:749)
    at e.load (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:13:941)
    at i (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:29:839)
    at Object.errorback (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:29:963)
    at e.triggerErrorback (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:14:306)
    at /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:14:10
    at ReadFileContext.callback (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:17:221)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:264:13) {
  tries: [
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/build/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/build/Debug/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/build/Release/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/out/Debug/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/Debug/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/out/Release/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/Release/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/build/default/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/compiled/14.8.0/android/arm/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/addon-build/release/install-root/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/addon-build/debug/install-root/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/addon-build/default/install-root/spdlog.node',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/lib/binding/node-v83-android-arm/spdlog.node'
  ],
  phase: 'loading',
  moduleId: 'spdlog',
  neededBy: [ '===anonymous3===' ]
}
[2020-10-07T06:05:50.597Z] warn  vscode Unable to retrieve mac address (Error: Command failed: /sbin/ifconfig -a || /sbin/ip link
/data/data/com.termux/files/usr/bin/sh: 1: /sbin/ifconfig: Permission denied
/data/data/com.termux/files/usr/bin/sh: 1: /sbin/ip: Permission denied
)
[2020-10-07T06:06:01.430Z] warn  vscode ENOENT: no such file or directory, scandir '/data/data/com.termux/files/home/.local/share/code-server/logs'

then what should i do? please give me some suggestions

2

There are 2 answers

3
Morrison Chang On

VSCode is already available in Termux. Note that you should have a good/stable internet connection while running instructions.

Inside Termux:

  1. Install NodeJS.

pkg install nodejs

  1. Install yarn

pkg install yarn

  1. From the Termux NodeJS wiki, install

pkg install build-essential

pkg install python

  1. Install code-server

yarn global add code-server

This will take a while. Be patient.

  1. Run code-server or code-server & which will run code-server in background.

Per the output, the password is in ~/.config/code-server/config.yaml

  1. Use Samsung Internet (Android app) or Chrome for Android to connect to 127.0.0.1:8080, enter password, and you should now have VSCode running on your device.
0
Ken Kanaki On

I found a better solution for it. I installed proot-distro, then install parrot distribution and then I used this curl -fsSL https://code-server.dev/install.sh | sh to install it and now it's working properly so following steps

apt update
apt install proot-distro nano
proot-distro install ubuntu-20.04
proot-distro login ubuntu-20.04

after doing this login into your ubuntu by typing proot-distro login ubuntu-20.04 and now copy this code and past it

curl -fsSL https://code-server.dev/install.sh | sh
code-server

after installation run code-server when you will run it first time it will create ~/.config/code-server/config.yaml file so now close the server and use nano ~/.config/code-server/config.yaml to set the password for code-server

bind-addr: 127.0.0.1:8080
auth: password
password: your-password
cert: none