coder / code-server

VS Code in the browser
https://coder.com
MIT License
67.72k stars 5.56k forks source link

update Termux docs #1730

Closed 871690991 closed 3 years ago

871690991 commented 4 years ago

The new version can't run, DEP can't install incompatible system, code package can't run, can't create / usr / local / bin directory, I don't have root permission, I hope the author can change the code package directory to the current user's home directory. 新版的无法运行,dep无法安装不兼容我的系统,code 包无法运行无法创建/usr/local/bin目录 我没有root权限,希望作者能把code包目录改为当前用户家目录. I'm crazy.

$ ./code-server ./code-server: 20: exec: /data/data/com.termux/files/home/code-server-3.3.1-linux-arm64/bin/../lib/node: not found

https://github.com/cdr/code-server/issues/1685 $ mkdir -p /usr/local/bin/ mkdir: cannot create directory ‘/usr’: Read-only file system

$ dpkg -i code-server_3.3.1_arm64.deb dpkg: error processing archive code-server_3.3.1_arm64.deb (--install): package architecture (arm64) does not match system (aarch64) Errors were encountered while processing: code-server_3.3.1_arm64.deb

871690991 commented 4 years ago

Version: code-server_3.3.1_arm64.deb code-server-3.3.1-linux-arm64.tar.gz OS: aarch64

nhooyr commented 4 years ago

What does dpkg --print-architecture show?

nhooyr commented 4 years ago

Also, please provide your OS version, i.e debian/ubuntu/centOS/macOS/Windows etc.

nhooyr commented 4 years ago
nhooyr commented 4 years ago

Try using our auto install script.

See https://github.com/cdr/code-server#getting-started

871690991 commented 4 years ago

Also, please provide your OS version, i.e debian/ubuntu/centOS/macOS/Windows etc.

My operating system is termux on Android

871690991 commented 4 years ago

Try using our auto install script.

See https://github.com/cdr/code-server#getting-started

Can the next version be compatible with termux?

nhooyr commented 4 years ago

No idea, don't know what termux or what's causing this issue.

871690991 commented 4 years ago

No idea, don't know what termux or what's causing this issue.

The old version of termux can run directly, but the new version cannot. Do you have an Android phone to download a termux,you open http://termux.com

871690991 commented 4 years ago

No idea, don't know what termux or what's causing this issue.

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.

871690991 commented 4 years ago

No idea, don't know what termux or what's causing this issue.

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.

Some Android phones are connected to the display, such as Samsung, Huawei and smartisan phones, to realize Android programming and development

code-asher commented 4 years ago

Here's a summary of the issues I ran into trying this out. My initial post is below the line.


Huh yeah that's interesting, the deb won't install because arm64 doesn't match aarch64? I thought they were the same thing?

I was able to get around that with:

$ dpkg --add-architecture arm64

However this still fails because it's trying to install to /usr. There is a PREFIX environment variable although it's one level too deep:

$ dpkg --inst-dir $PREFIX/.. -i code-server_3.3.1_arm64.deb

I'm not sure if we can fix this on our end; I'm not familiar enough with either termux or dpkg. Maybe there is some system default set somewhere that we can inherit or maybe debs have to be specially packaged for Termux to account for the path difference or maybe there's some other way to detect the right path like using that PREFIX environment variable if it exists.

Unfortunately running code-server still doesn't work at this point because it's trying to execute /usr/lib/code-server/bin/code-server. I tried running $PREFIX/lib/code-server/bin/code-server directly but node exits with no such file or directory. I think what it really means is there is some kind of missing library because the file does exist.

So I installed Node:

$ pkg install nodejs
$ node "$PREFIX/lib/code-server"

And it almost works! But it errors with libstdc++.so.6 not found when loading the spdlog module.

Then I tried out the npm module:

npm -g install code-server

But now I get Could not locate the bindings file for spdlog after running code-server and logging in. I don't know what's causing this one.

Going back to the no such file error:

$ file "$PREFIX/lib/code-server/lib/node"
/data/data/com.termux/files/usr/lib/code-server/lib/node: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=8de174bf29b02b0e727ca5cd7c4ede9ef35bb8cc, with debug_info, not stripped

Is it because /lib/ld-linux-aarch64.so.1 doesn't exist, maybe? Here's what I get for git:

$ file $(readlink -f $(which git))
/data/data/com.termux/files/usr/libexec/git-core/git: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, stripped

So how about:

$ pkg install patchelf
$ patchelf --set-interpreter /system/bin/linker64 $PREFIX/lib/code-server/lib/node

Unfortunately this results in:

error: Android 5.0 and later only support position-independent executables (-fPIE).
code-asher commented 4 years ago

One other summary item:

code-asher commented 4 years ago

So running the bundled code-server script resolves the libstdc++.so.6 error since it sets LD_LIBRARY_PATH (I edited it to just run my system node to avoid the linker issue with the bundled one), the next error is:

dlopen failed: library "libm.so.6" not found
nhooyr commented 4 years ago

Yea the path is hard coded to /usr/lib/code-server. That's just how .deb works or at least nfpm works anyway.

nhooyr commented 4 years ago

dlopen failed: library "libm.so.6" not found

wtf, that means you don't have libc

nhooyr commented 4 years ago

This might be somewhat fixed by the compilation on CentOS 7 in #1761

nhooyr commented 4 years ago

I think it's best to not use the .deb on termux, best to use a standalone release.

Should modify the install script to do this instead of installing the .deb.

nhooyr commented 4 years ago

How does /etc/os-release look @code-asher?

nhooyr commented 4 years ago

Actually there is no /etc/os-release on termux so it should already be installing via the .tar.gz instead of the .deb.

nhooyr commented 4 years ago

Once v3.4.1 is released I'll ping here so you guys can test the standalone release in termux.

hnmn commented 4 years ago

Try yarn global add code-server Screenshot_2020-06-05-12-21-46-703_com android chrome

Karthikb777 commented 4 years ago

Try yarn global add code-server Screenshot_2020-06-05-12-21-46-703_com android chrome

I tried this, but it always asks for a reload every 2 seconds.

librehat commented 4 years ago

I've run into the same issue seen by @Karthikb777.

Environment

Android 9 on Samsung Galaxy Tab S5e latest Termux, node 14 standalone code-server 3.4.1 arm64 tar.gz with a few modifications (explained below) Google Chrome browser

The bundled node binary cannot be executed, therefore I've replaced it with a symlink to the node installed via termux pkg. After that I ran into the telemetry issues which can be turned off by --disable-telemetry. Then it's the precompiled spdlog module using libstdc++ issue commented by @code-asher. To solve it, I went into lib/vscode and deleted node_modules/spdlog folder, and reinstalled it via node install spdlog which will compile using libc++. After all these, I restarted code-server, there is no error in the output (I've turned on the verbose output too) but in Chrome the connection just gets disconnected after 2 seconds. The verbose output from code-server is pasted below

./code-server --auth none --disable-telemetry -vvv info Using config file ~/.config/code-server/config.yaml debug parsed command line {"args":{"":[],"bind-addr":"127.0.0.1:8080","auth":"password","password":"6eae128e071109ecc630c6a7"}} debug spawned inner process 15952 debug parsed command line {"args":{"":[],"auth":"none","disable-telemetry":true,"verbose":true}} debug parsed command line {"args":{"":[],"bind-addr":"127.0.0.1:8080","auth":"password","password":"6eae128e071109ecc630c6a7"}} debug wrapper 15933 received message from 15952 {"message":{"type":"handshake"}} debug inner process 15952 received message from 15933 {"message":{"type":"handshake"}} info Using user-data-dir ~/.local/share/code-server trace Using extensions-dir ~/.local/share/code-server/extensions info code-server 3.4.1 48f7c2724827e526eeaa6c2c151c520f48a61259 info HTTP server listening on http://127.0.0.1:8080 info - No authentication info - Not serving HTTPS trace heartbeat debug forking vs code... debug got message from vs code {"message":{"type":"ready"}} debug setting up vs code... debug vscode got message from code-server {"message":{"type":"init","id":"pPf6Qo5CvT563rZUyxA7Eus1","options":{"args":{"":[],"bind-addr":"127.0.0.1:8080","auth":"none","password":"6eae128e071109ecc630c6a7","log":"trace","verbose":true,"config":"/data/data/com.termux/files/home/.config/code-server/config.yaml","disable-telemetry":true,"user-data-dir":"/data/data/com.termux/files/home/.local/share/code-server","extensions-dir":"/data/data/com.termux/files/home/.local/share/code-server/extensions"},"remoteAuthority":"127.0.0.1:8080"}}} [server] storing proxy {"proxyId":"child_process"} [server] storing proxy {"proxyId":"fs"} [server] storing proxy {"proxyId":"net"} debug got message from vs code {"message":{"type":"options","id":"pPf6Qo5CvT563rZUyxA7Eus1","options":{"workbenchWebConfiguration":{"remoteAuthority":"127.0.0.1:8080","logLevel":0,"workspaceProvider":{"payload":[["userDataPath","/data/data/com.termux/files/home/.local/share/code-server"]]}},"remoteUserDataUri":{"$mid":1,"path":"/data/data/com.termux/files/home/.local/share/code-server","scheme":"vscode-remote","authority":"127.0.0.1:8080"},"productConfiguration":{"nameShort":"Code - OSS","nameLong":"Code - OSS","applicationName":"code-oss","dataFolderName":".vscode-oss","win32MutexName":"vscodeoss","licenseName":"MIT","licenseUrl":"https://github.com/Microsoft/vscode/blob/master/LICENSE.txt","win32DirName":"Microsoft Code OSS","win32NameVersion":"Microsoft Code OSS","win32RegValueName":"CodeOSS","win32AppId":"{{E34003BB-9E10-4501-8C11-BE3FAA83F23F}","win32x64AppId":"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}","win32UserAppId":"{{C6065F05-9603-4FC4-8101-B9781A25D88E}","win32x64UserAppId":"{{C6065F05-9603-4FC4-8101-B9781A25D88E}","win32AppUserModelId":"Microsoft.CodeOSS","win32ShellNameShort":"C&ode - OSS","darwinBundleIdentifier":"com.visualstudio.code.oss","linuxIconName":"com.visualstudio.code.oss","licenseFileName":"LICENSE.txt","reportIssueUrl":"https://github.com/cdr/code-server/issues/new","urlProtocol":"code-oss","extensionAllowedProposedApi":["ms-vscode.vscode-js-profile-table","ms-vscode.references-view"],"builtInExtensions":[{"name":"ms-vscode.node-debug","version":"1.44.5","repo":"https://github.com/Microsoft/vscode-node-debug","metadata":{"id":"b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.node-debug2","version":"1.42.2","repo":"https://github.com/Microsoft/vscode-node-debug2","metadata":{"id":"36d19e17-7569-4841-a001-947eb18602b2","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.references-view","version":"0.0.51","repo":"https://github.com/Microsoft/vscode-reference-view","metadata":{"id":"dc489f46-520d-4556-ae85-1f9eab3c412d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.js-debug-companion","version":"1.0.0","repo":"https://github.com/microsoft/vscode-js-debug-companion","metadata":{"id":"99cb0b7f-7354-4278-b8da-6cc79972169d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.js-debug-nightly","version":"2020.4.2917","repo":"https://github.com/Microsoft/vscode-js-debug","metadata":{"id":"7acbb4ce-c85a-49d4-8d95-a8054406ae97","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.vscode-js-profile-table","version":"0.0.2","repo":"https://github.com/Microsoft/vscode-js-debug","metadata":{"id":"7e52b41b-71ad-457b-ab7e-0620f1fc4feb","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}}],"commit":"48f7c2724827e526eeaa6c2c151c520f48a61259","date":"2020-06-04T10:39:14Z","version":"1.45.1","extensionsGallery":{"serviceUrl":"https://extensions.coder.com/api","itemUrl":"","controlUrl":"","recommendationsUrl":""}},"nlsConfiguration":{"locale":"en","availableLanguages":{}},"commit":"48f7c2724827e526eeaa6c2c151c520f48a61259"}}} debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"Management","reconnectionToken":"ba7bb37f-1df2-440c-b4a8-c2570f66b3e8","reconnection":"false","skipWebSocketFrames":"false"}}} debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"ExtensionHost","reconnectionToken":"316b4d9f-f41b-4ec1-9398-7337c491c29b","reconnection":"false","skipWebSocketFrames":"false"}}} debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"ExtensionHost","reconnectionToken":"316b4d9f-f41b-4ec1-9398-7337c491c29b","reconnection":"true","skipWebSocketFrames":"false"}}}

gaui commented 4 years ago

Try yarn global add code-server Screenshot_2020-06-05-12-21-46-703_com android chrome

Closest towards working but I get:

$ code-server
info  Wrote default config file to ~/.config/code-server/config.yaml
info  Using config file ~/.config/code-server/config.yaml
info  Using user-data-dir ~/.local/share/code-server
info  code-server 3.4.1 48f7c2724827e526eeaa6c2c151c520f48a61259
info  HTTP server listening on http://127.0.0.1:8080
info      - Using password from ~/.config/code-server/config.yaml
info      - To disable use `--auth none`
info    - Not serving HTTPS
^C$ code-server --auth none
info  Using config file ~/.config/code-server/config.yaml
info  Using user-data-dir ~/.local/share/code-server
info  code-server 3.4.1 48f7c2724827e526eeaa6c2c151c520f48a61259
info  HTTP server listening on http://127.0.0.1:8080
info    - No authentication
info    - Not serving HTTPS
warn  discarding socket connection: vscode is not running
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.4.0/android/arm64/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-arm64/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:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089: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:73:18)
    at t.load (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:16:119)
    at e.load (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:13:586)
    at i (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:29:259)
    at Object.errorback (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:29:383)
    at e.triggerErrorback (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:13:955)
    at /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:13:659
    at ReadFileContext.callback (/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/loader.js:16:494)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:260: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.4.0/android/arm64/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-arm64/spdlog.node'
  ],
  phase: 'loading',
  moduleId: 'spdlog',
  neededBy: [ '===anonymous3===' ]
}
[2020-06-28T21:15:54.338Z] 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: not found
/data/data/com.termux/files/usr/bin/sh: 1: /sbin/ip: not found
)
[2020-06-28T21:16:04.373Z] warn  vscode ENOENT: no such file or directory, scandir '/data/data/com.termux/files/home/.local/share/code-server/logs'

Running find on spdlog ...

$ find . -name spdlog

./.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog   

./.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/deps/spdlog                      

./.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/deps/spdlog/include/spdlog        

./.cache/yarn/v6/npm-spdlog-0.11.1-29721b31018a5fe6a3ce2531f9d8d43e0bd6b825-integrity/node_modules/spdlog       

./.cache/yarn/v6/npm-spdlog-0.11.1-29721b31018a5fe6a3ce2531f9d8d43e0bd6b825-integrity/node_modules/spdlog/deps/spdlog                                                   

./.cache/yarn/v6/npm-spdlog-0.11.1-29721b31018a5fe6a3ce2531f9d8d43e0bd6b825-integrity/node_modules/spdlog/deps/spdlog/include/spdlog                                    ./.local/lib/code-server-3.4.1/lib/vscode/node_modules/spdlog                                                   ./.local/lib/code-server-3.4.1/lib/vscode/node_modules/spdlog/deps/spdlog                                       ./.local/lib/code-server-3.4.1/lib/vscode/node_modules/spdlog/deps/spdlog/include/spdlog                        ./.local/lib/code-server-3.4.1/lib/vscode/node_modules/spdlog/build/Release/.deps/Release/obj.target/spdlog     

./.local/lib/code-server-3.4.1/lib/vscode/node_modules/spdlog/build/Release/obj.target/spdlog
Logic530 commented 4 years ago

I believe I'm having similar issue.

Info

OS (not really an os I suppose): Termux app on Android (app version 0.94) code-server: version 3.4.1 arm64 standalone (latest release) with nodejs executable symbolic linked to another file (explain later) nodejs version (not the original one): v14.4.0

And, if useful, some info about my phone:

Android version: 10 OS: MIUI 12 Model: Xiaomi CC9 Pro

How to produce the issue

  1. Download the latest arm64 standalone release of code-server and extract the file.
  2. Run code-server-dir/bin/code-server --auth none in Termux.
  3. code-server does not start, error message saying something like "could not find code-server-dir/lib/node, no such file or directory".
  4. But I know there is a usable nodejs package for Termux, so I get it by running apt install nodejs in Termux. (The package should come from a special repository for Termux.)
  5. Create a symbolic link at code-server-dir/lib/ replacing the original executable, and the target is the usable nodejs executable installed.
  6. Run code-server-dir/bin/code-server --auth none again, and code-server starts, showing normal startup message. (I changed the config to listen all address)
    info  Using config file ~/.config/code-server/config.yaml
    info  Using user-data-dir ~/.local/share/code-server
    info  code-server 3.4.1 48f7c2724827e526eeaa6c2c151c520f48a61259
    info  HTTP server listening on http://0.0.0.0:8080
    info    - No authentication
    info    - Not serving HTTPS
  7. Access http://localhost:8080 in my phone browser (Chrome), the page loads but after a few seconds it asks to reconnect, and the connection is lost.
  8. In Termux, code-server prints following error message:
    Error: dlopen failed: library "libstdc++.so.6" not found
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1250:18)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at Module.patchedRequire [as require] (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/node_modules/diagnostic-channel/dist/src/patchRequire.js:14:46)
    at require (internal/modules/cjs/helpers.js:73:18)
    at bindings (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/node_modules/spdlog/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/node_modules/spdlog/index.js:3:35)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at Module.patchedRequire [as require] (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/node_modules/diagnostic-channel/dist/src/patchRequire.js:14:46)
    at require (internal/modules/cjs/helpers.js:73:18)
    at t.load (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/out/vs/loader.js:16:119)
    at e.load (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/out/vs/loader.js:13:586)
    at i (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/out/vs/loader.js:29:259)
    at Object.errorback (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/out/vs/loader.js:29:383)
    at e.triggerErrorback (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/out/vs/loader.js:13:955)
    at /data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/out/vs/loader.js:13:659
    at ReadFileContext.callback (/data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/vscode/out/vs/loader.js:16:494)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:260:13) {
    phase: 'loading',
    moduleId: 'spdlog',
    neededBy: [ '===anonymous3===' ]
    }
    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
    )
    warn  vscode ENOENT: no such file or directory, scandir '/data/data/com.termux/files/home/.local/share/code-server/logs'
  9. I also tried access code-server using chrome on my laptop, same issue. Browser console as below:
    log.ts:185  INFO [remote-connection][ExtensionHost][aa0f2…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
    log.ts:185  INFO [remote-connection][ExtensionHost][aa0f2…][reconnect] waiting for 5 seconds before reconnecting...
    log.ts:185  INFO [remote-connection][ExtensionHost][aa0f2…][reconnect] resolving connection...
    log.ts:185  INFO [remote-connection][ExtensionHost][aa0f2…][reconnect] connecting to 192.168.1.103:8080...
    log.ts:197   ERR [remote-connection][ExtensionHost][aa0f2…][reconnect][192.168.1.103:8080] received error control message when negotiating connection. Error:
    log.ts:197   ERR Error: Connection error: Unrecognized reconnection token
    at k (remoteAgentConnection.ts:553)
    at remoteAgentConnection.ts:189
    at e.fire (event.ts:587)
    at v.fire (ipc.net.ts:453)
    at t.PersistentProtocol._receiveMessage (ipc.net.ts:736)
    at ipc.net.ts:688
    at e.fire (event.ts:587)
    at g.acceptChunk (ipc.net.ts:239)
    at ipc.net.ts:200
    at browserSocketFactory.ts:178
    log.ts:197   ERR [remote-connection][ExtensionHost][aa0f2…][reconnect] A permanent error occurred in the reconnecting loop! Will give up now! Error:
    log.ts:197   ERR Error: Connection error: Unrecognized reconnection token
    at k (remoteAgentConnection.ts:553)
    at remoteAgentConnection.ts:189
    at e.fire (event.ts:587)
    at v.fire (ipc.net.ts:453)
    at t.PersistentProtocol._receiveMessage (ipc.net.ts:736)
    at ipc.net.ts:688
    at e.fire (event.ts:587)
    at g.acceptChunk (ipc.net.ts:239)
    at ipc.net.ts:200
    at browserSocketFactory.ts:178
    abstractExtensionService.ts:155 Extension host terminated unexpectedly. Code:  0  Signal:  null
    _onExtensionHostCrashed @ abstractExtensionService.ts:143
    _onExtensionHostCrashOrExit @ abstractExtensionService.ts:143
    (anonymous) @ abstractExtensionService.ts:101
    fire @ event.ts:535
    _onExtHostConnectionLost @ remoteExtensionHostClient.ts:180
    (anonymous) @ remoteExtensionHostClient.ts:116
    fire @ event.ts:535
    fire @ ipc.net.ts:390
    acceptDisconnect @ ipc.net.ts:680
    x @ remoteAgentConnection.ts:499
    _gotoPermanentFailure @ remoteAgentConnection.ts:455
    (anonymous) @ remoteAgentConnection.ts:354
    triggerPermanentFailure @ remoteAgentConnection.ts:354
    _runReconnectingLoop @ remoteAgentConnection.ts:432
    async function (async)
    _runReconnectingLoop @ remoteAgentConnection.ts:354
    _beginReconnecting @ remoteAgentConnection.ts:354
    (anonymous) @ remoteAgentConnection.ts:325
    fire @ event.ts:535
    fire @ ipc.net.ts:390
    (anonymous) @ ipc.net.ts:583
    fire @ event.ts:535
    (anonymous) @ browserSocketFactory.ts:59

    Some clue

    Seems like the issue is caused by missing libstdc++.so.6, and this might have something to do with Termux environment. But I am really a noob at Linux and OS stuff. So it's all my guessing XD

mdeabreu commented 4 years ago

I tried the latest 3.4.1 standalone release and unfortunately am running into a number of issues. I’ll try to describe them here so that anyone can follow along and see the issues plus the work arounds that have been found.

Info

Device: OnePlus 6T OS: Android 10 (OxygenOS 10.3.4), running Termux 0.95 Code-Server: 3.4.1 standalone arm64 NodeJS: replaced bundled node with system node 14.4.0

Problems and Partial Solutions

This section assumes you have a fresh Termux environment.

  1. Update environment pkg upgrade
  2. Download code-server standalone curl -O -L https://github.com/cdr/code-server/releases/download/v3.4.1/code-server-3.4.1-linux-arm64.tar.gz
  3. Extract tar -xvf code-server-3.4.1-linux-arm64.tar.gz
  4. Attempt to run cd code-server-3.4.1-linux-arm64 && ./bin/code-server --auth none

At this point you will run into the first issue: ./bin/code-server: 36: exec: /data/data/com.termux/files/home/code-server-3.4.1-linux-arm64/lib/node: not found

Let’s fix this by installing node into termux and replacing the file with a symlink.

  1. pkg install nodejs
  2. replace local node with symlink rm lib/node && ln -s $(which node) lib/node

When we try running again ./bin/code-server --auth none everything appears to work but when we connect we see a bunch of errors one after another. Let’s fix them in turn.

We can fix the Unable to retrieve mac address... error by appending --disable-telemetry to our launch command.

The issues with spdlog can be fixed by manually re-installing spdlog (and the python termux package which is necessary to build).

  1. cd lib/vscode && rm -rf node_modules/spdlog && pkg install python && npm install spdlog && cd ../..

Now we can put it all together ./bin/code-server --auth none --disable-telemetry

Code-server launches as expected, we can open the browser and see code-server but after a couple seconds we will always lose connection: Cannot reconnect. Please reload the window.


Here is the output from ./bin/code-server --auth none --disable-telemetry -vvv to see if there is anything interesting in the logs.


$ ./bin/code-server --auth none --disable-telemetry -vvv
info  Using config file ~/.config/code-server/config.yaml
debug parsed command line {"args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"password","password":"45521deb999019cb818da5da"}}
debug spawned inner process 28127
debug parsed command line {"args":{"_":[],"auth":"none","disable-telemetry":true,"verbose":true}}
debug parsed command line {"args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"password","password":"45521deb999019cb818da5da"}}
debug wrapper 28109 received message from 28127 {"message":{"type":"handshake"}}
debug inner process 28127 received message from 28109 {"message":{"type":"handshake"}}
info  Using user-data-dir ~/.local/share/code-server
trace Using extensions-dir ~/.local/share/code-server/extensions
info  code-server 3.4.1 48f7c2724827e526eeaa6c2c151c520f48a61259
info  HTTP server listening on http://127.0.0.1:8080
info    - No authentication
info    - Not serving HTTPS
trace heartbeat
debug forking vs code...
debug got message from vs code {"message":{"type":"ready"}}
debug setting up vs code...
debug vscode got message from code-server {"message":{"type":"init","id":"nGEXFSRl2ocjfJ0HRVActKQH","options":{"args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"none","password":"45521deb999019cb818da5da","log":"trace","verbose":true,"config":"/data/data/com.termux/files/home/.config/code-server/config.yaml","disable-telemetry":true,"user-data-dir":"/data/data/com.termux/files/home/.local/share/code-server","extensions-dir":"/data/data/com.termux/files/home/.local/share/code-server/extensions"},"remoteAuthority":"127.0.0.1:8080"}}}
[server] storing proxy {"proxyId":"child_process"}
[server] storing proxy {"proxyId":"fs"}
[server] storing proxy {"proxyId":"net"}
debug got message from vs code {"message":{"type":"options","id":"nGEXFSRl2ocjfJ0HRVActKQH","options":{"workbenchWebConfiguration":{"remoteAuthority":"127.0.0.1:8080","logLevel":0,"workspaceProvider":{"payload":[["userDataPath","/data/data/com.termux/files/home/.local/share/code-server"]]}},"remoteUserDataUri":{"$mid":1,"path":"/data/data/com.termux/files/home/.local/share/code-server","scheme":"vscode-remote","authority":"127.0.0.1:8080"},"productConfiguration":{"nameShort":"Code - OSS","nameLong":"Code - OSS","applicationName":"code-oss","dataFolderName":".vscode-oss","win32MutexName":"vscodeoss","licenseName":"MIT","licenseUrl":"https://github.com/Microsoft/vscode/blob/master/LICENSE.txt","win32DirName":"Microsoft Code OSS","win32NameVersion":"Microsoft Code OSS","win32RegValueName":"CodeOSS","win32AppId":"{{E34003BB-9E10-4501-8C11-BE3FAA83F23F}","win32x64AppId":"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}","win32UserAppId":"{{C6065F05-9603-4FC4-8101-B9781A25D88E}","win32x64UserAppId":"{{C6065F05-9603-4FC4-8101-B9781A25D88E}","win32AppUserModelId":"Microsoft.CodeOSS","win32ShellNameShort":"C&ode - OSS","darwinBundleIdentifier":"com.visualstudio.code.oss","linuxIconName":"com.visualstudio.code.oss","licenseFileName":"LICENSE.txt","reportIssueUrl":"https://github.com/cdr/code-server/issues/new","urlProtocol":"code-oss","extensionAllowedProposedApi":["ms-vscode.vscode-js-profile-table","ms-vscode.references-view"],"builtInExtensions":[{"name":"ms-vscode.node-debug","version":"1.44.5","repo":"https://github.com/Microsoft/vscode-node-debug","metadata":{"id":"b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.node-debug2","version":"1.42.2","repo":"https://github.com/Microsoft/vscode-node-debug2","metadata":{"id":"36d19e17-7569-4841-a001-947eb18602b2","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.references-view","version":"0.0.51","repo":"https://github.com/Microsoft/vscode-reference-view","metadata":{"id":"dc489f46-520d-4556-ae85-1f9eab3c412d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.js-debug-companion","version":"1.0.0","repo":"https://github.com/microsoft/vscode-js-debug-companion","metadata":{"id":"99cb0b7f-7354-4278-b8da-6cc79972169d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.js-debug-nightly","version":"2020.4.2917","repo":"https://github.com/Microsoft/vscode-js-debug","metadata":{"id":"7acbb4ce-c85a-49d4-8d95-a8054406ae97","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.vscode-js-profile-table","version":"0.0.2","repo":"https://github.com/Microsoft/vscode-js-debug","metadata":{"id":"7e52b41b-71ad-457b-ab7e-0620f1fc4feb","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}}],"commit":"48f7c2724827e526eeaa6c2c151c520f48a61259","date":"2020-06-04T10:39:14Z","version":"1.45.1","extensionsGallery":{"serviceUrl":"https://extensions.coder.com/api","itemUrl":"","controlUrl":"","recommendationsUrl":""}},"nlsConfiguration":{"locale":"en","availableLanguages":{}},"commit":"48f7c2724827e526eeaa6c2c151c520f48a61259"}}}
debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"Management","reconnectionToken":"01154a63-5d90-45df-9e17-7732d0d1a5af","reconnection":"false","skipWebSocketFrames":"false"}}}
debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"ExtensionHost","reconnectionToken":"1f398295-d0c7-40f7-aaa5-2a2028c4a8da","reconnection":"false","skipWebSocketFrames":"false"}}}
debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"ExtensionHost","reconnectionToken":"1f398295-d0c7-40f7-aaa5-2a2028c4a8da","reconnection":"true","skipWebSocketFrames":"false"}}}
^C
debug inner process 28127 disposing {"code":"SIGINT"}
debug wrapper 28109 disposing {"code":"SIGINT"}
mdeabreu commented 4 years ago

Workaround

I believe I’ve found a work around that will get past all the issues and remain connected. Tutorial below assumes a fresh Termux environment.

  1. Update environment: pkg upgrade
  2. Install pre-requisites: pkg install python nodejs yarn
  3. Install code-server, this can take some time: yarn global add code-server
  4. Launch: code-server -- auth none --disable-telemetry

You should now be able to open code-server in your browser and stay connected!

I’m hopeful this works for others!

code-asher commented 4 years ago

Interesting, I tried the yarn method before but it failed when building spdlog.

But I ran it again just now following your steps and everything went off without a hitch. Awesome!!

Karthikb777 commented 4 years ago

Screenshot_20200717-071826544.jpg

Everything seems to work fine,I tried using the yarn method, but EACCES error shows up and I can't use backspace in the editor for some reason.

Edit: I managed to get rid of EACCES error but still couldn't use backspace.

I'm gonna try connecting a wired keyboard and try it today and will update about what happens.

marissa999 commented 4 years ago

I managed to get code-server working without a single problem in the past by using a proot. https://github.com/sdrausty/termux-archlinux Besides arch you can also use any other distro in the proot. AndroNix might be interesting too. The problem with Termux on its own is that a lot of dependencies are missing and that Android does not follow the Linux standard filesystem hierarchy. https://wiki.termux.com/wiki/Differences_from_Linux Those are both problems you can bypass by running code-server in a proot in termux on Android.

bitwisebro commented 4 years ago

Have you found any permanent solution? I'm trying to run code-server on Termux too, but it doesn't works.

Karthikb777 commented 4 years ago

Have you found any permanent solution? I'm trying to run code-server on Termux too, but it doesn't works.

Yes, I am running code server on termux but I plug in an external keyboard as code server cannot recognise backspace in the virtual keyboard. I used the yarn method to install it.

15838639131 commented 4 years ago

@Karthikb777 you can set "keyboard.dispatch": "keyCode",

chakibchemso commented 3 years ago

This can answer everything https://github.com/vhqtvn/VHEditor-Android It's an app with built in termux and vscs And working perfectly except the c# extension didn't detect the arch of my device Anyway the editor is working

izewang commented 3 years ago

Here is what I got with the 'yarn' method in a fresh Termux environment. The web page shows 500 Error.

Error: Cannot find module 'semver-umd'
Require stack:
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88: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:273:13) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js'
  ],
  phase: 'loading',
  moduleId: 'semver-umd',
  neededBy: [
    'vs/platform/extensionManagement/node/extensionDownloader',
    'vs/workbench/services/extensions/node/extensionPoints',
    'vs/platform/extensionManagement/node/extensionsScanner',
    'vs/platform/extensionManagement/node/extensionManagementService'
  ]
}
Error: Cannot find module 'applicationinsights'
Require stack:
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88: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:273:13) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js'
  ],
  phase: 'loading',
  moduleId: 'applicationinsights',
  neededBy: [ 'vs/platform/telemetry/node/appInsightsAppender' ]
}
Error: Cannot find module '@coder/node-browser'
Require stack:
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88: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:273:13) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js'
  ],
  phase: 'loading',
  moduleId: '@coder/node-browser',
  neededBy: [ 'vs/server/node/channel' ]
}
Error: Cannot find module 'yauzl'
Require stack:
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88: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:273:13) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js'
  ],
  phase: 'loading',
  moduleId: 'yauzl',
  neededBy: [ 'vs/base/node/zip' ]
}
Error: Cannot find module 'yazl'
Require stack:
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js
- /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88: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:273:13) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/bootstrap-amd.js',
    '/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/server/fork.js'
  ],
  phase: 'loading',
  moduleId: 'yazl',
  neededBy: [ 'vs/base/node/zip' ]
}

If I installed the missing modules by "yarn global add semver-umd applicationinsights @coder/node-browser yauzl yazl spdlog" I dont' get any error, but the web page is blank.

Here is the -vvv log

[server] storing proxy {"proxyId":"child_process"}
[server] storing proxy {"proxyId":"fs"}
[server] storing proxy {"proxyId":"net"}
[2020-10-23T21:29:48.795Z] debug got message from vs code {"message":{"type":"options","id":"oWmpI2NSmgckZvNqQHzoppvG","options":{"workbenchWebConfiguration":{"folderUri":{"$mid":1,"path":"/home","scheme":"vscode-remote","authority":"192.168.0.109:8000"},"remoteAuthority":"192.168.0.109:8000","logLevel":0,"workspaceProvider":{"payload":[["userDataPath","/data/data/com.termux/files/home/.local/share/code-server"],["enableProposedApi","[]"]]}},"remoteUserDataUri":{"$mid":1,"path":"/data/data/com.termux/files/home/.local/share/code-server","scheme":"vscode-remote","authority":"192.168.0.109:8000"},"productConfiguration":{"nameShort":"Code - OSS","nameLong":"Code - OSS","applicationName":"code-oss","dataFolderName":".vscode-oss","win32MutexName":"vscodeoss","licenseName":"MIT","licenseUrl":"https://github.com/Microsoft/vscode/blob/master/LICENSE.txt","win32DirName":"Microsoft Code OSS","win32NameVersion":"Microsoft Code OSS","win32RegValueName":"CodeOSS","win32AppId":"{{E34003BB-9E10-4501-8C11-BE3FAA83F23F}","win32x64AppId":"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}","win32arm64AppId":"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}","win32UserAppId":"{{C6065F05-9603-4FC4-8101-B9781A25D88E}","win32x64UserAppId":"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}","win32arm64UserAppId":"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}","win32AppUserModelId":"Microsoft.CodeOSS","win32ShellNameShort":"C&ode - OSS","darwinBundleIdentifier":"com.visualstudio.code.oss","linuxIconName":"com.visualstudio.code.oss","licenseFileName":"LICENSE.txt","reportIssueUrl":"https://github.com/cdr/code-server/issues/new","urlProtocol":"code-oss","extensionAllowedProposedApi":["ms-vscode.vscode-js-profile-flame","ms-vscode.vscode-js-profile-table","ms-vscode.references-view","ms-vscode.github-browser"],"builtInExtensions":[{"name":"ms-vscode.node-debug","version":"1.44.11","repo":"https://github.com/Microsoft/vscode-node-debug","metadata":{"id":"b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.node-debug2","version":"1.42.5","repo":"https://github.com/Microsoft/vscode-node-debug2","metadata":{"id":"36d19e17-7569-4841-a001-947eb18602b2","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.references-view","version":"0.0.62","repo":"https://github.com/Microsoft/vscode-reference-view","metadata":{"id":"dc489f46-520d-4556-ae85-1f9eab3c412d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.js-debug-companion","version":"1.0.7","repo":"https://github.com/microsoft/vscode-js-debug-companion","metadata":{"id":"99cb0b7f-7354-4278-b8da-6cc79972169d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.js-debug","version":"1.49.8","repo":"https://github.com/Microsoft/vscode-js-debug","metadata":{"id":"25629058-ddac-4e17-abba-74678e126c5d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.vscode-js-profile-table","version":"0.0.6","repo":"https://github.com/Microsoft/vscode-js-debug","metadata":{"id":"7e52b41b-71ad-457b-ab7e-0620f1fc4feb","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}}],"webBuiltInExtensions":[{"name":"ms-vscode.github-browser","version":"0.0.8","repo":"https://github.com/Microsoft/vscode-github-browser","metadata":{"id":"c1bcff4b-4ecb-466e-b8f6-b02788b5fb5a","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}}],"commit":"a4a03c14922ccaec2a9ff8d1b7b2af8522a4214d","date":"2020-10-12T07:26:49Z","version":"1.49.3","extensionsGallery":{"serviceUrl":"https://extensions.coder.com/api","itemUrl":"","controlUrl":"","recommendationsUrl":""}},"nlsConfiguration":{"locale":"en","availableLanguages":{}},"commit":"a4a03c14922ccaec2a9ff8d1b7b2af8522a4214d"}}}
[2020-10-23T21:29:49.195Z] debug Request error {"url":"/static/a4a03c14922ccaec2a9ff8d1b7b2af8522a4214d/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/dist/pages/pages/vscode.js.map","code":404,"error":{"errno":-2,"code":"ENOENT","syscall":"open","path":"/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/dist/pages/pages/vscode.js.map"}}
[2020-10-23T21:29:50.383Z] debug Request error {"url":"/static/a4a03c14922ccaec2a9ff8d1b7b2af8522a4214d/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/semver-umd/lib/semver-umd.js","code":404,"error":{"errno":-2,"code":"ENOENT","syscall":"open","path":"/data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/semver-umd/lib/semver-umd.js"}}

It seems the folder "home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules" is missing. What shall I do now? I tried to npm install or yarn install inside /lib/vscode, but get more errors: "error /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/keytar: Command failed." "No package 'libsecret-1' found"

izewang commented 3 years ago

I finally got it worked. Here's what I did after the previous post:

pkg install git
yarn global remove code-server
yarn global add code-server
yozman commented 3 years ago

hey guys, there is whole lots of things u should do for use cdr on termux

pkg install nodejs git python build-essential pkg-config libx11
npm i -g yarn
yarn global add code-server

make sure your internet could open https://raw.githubusercontent.com/googleinterns/tsec/master/package.json correctly

if not (somewhere like china) u can use https://github.com/x-falcon/Virtual-Hosts for binding custom host like

199.232.68.133 .githubusercontent.com

after this, u can enjoy ur cdr on ur phone.

but there is still an issue on it with search feature

when use cdr/code-server with termux on android. search feature is not work because of missing bin/rg


update for fix search feature

  1. install ripgrep use pkg
pkg install ripgrep
  1. make a soft link use ln -s

run this command in ur code-server directory

ln -s $PREFIX/bin/rg ./lib/vscode/node_modules/vscode-ripgrep/bin/rg
tranqy commented 3 years ago

Thanks @yozman , that worked for me. I had tried a few other ways but was able to pkg uninstall yarn, reinstall yarn then reinstall code-server.

mahdimataji commented 3 years ago

Screenshot_۲۰۲۱۰۱۲۷-۰۲۲۰۰۰_Termux.jpg Hello Please solve this problem for me

n3rdw1z4rd commented 3 years ago

hey guys, there is whole lots of things u should do for use cdr on termux

pkg install nodejs git python build-essential pkg-config libx11
npm i -g yarn
yarn global add code-server

make sure your internet could open https://raw.githubusercontent.com/googleinterns/tsec/master/package.json correctly

if not (somewhere like china) u can use https://github.com/x-falcon/Virtual-Hosts for binding custom host like

199.232.68.133 .githubusercontent.com

after this, u can enjoy ur cdr on ur phone.

but there is still an issue on it with search feature

when use cdr/code-server with termux on android. search feature is not work because of missing bin/rg

update for fix search feature

  1. install ripgrep use pkg
pkg install ripgrep
  1. make a soft link use ln -s

run this command in ur code-server directory

ln -s $PREFIX/bin/rg ./lib/vscode/node_modules/vscode-ripgrep/bin/rg

This also worked for me, thank you!

jsjoeio commented 3 years ago

Now that we have some official documentation for Termux, I think we should add this there.

TODOs: