-
Install Termux, an Android terminal emulator that provides a Linux execution environment and various tools.
-
Update system packages in Termux:
$ pkg update -y
-
Install dependencies, including python, nodejs, and yarn:
$ pkg install -y python nodejs yarn git
-
Install code-server, an adaptation of Visual Studio Code that runs as a web app using the following command. The installation may take a while:
$ yarn global add code-server
-
Before starting code-server, we are going to fix an error caused by spdlog, which is a dependency of Visual Studio Code. First, change your working directory to
~/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/
:$ cd ~/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/
-
You will need a text editor for the next step. Here Vim is used for this task, but you are free to use whatever text editor you love:
$ pkg install vim
-
Open
binding.gyp
and enter edit mode. You can do this by pressingi
once you open the file using Vim:$ vim binding.gyp
-
Add
"libraries": [ "-latomic" ]
below"target_name": "spdlog",
. This helps spdlog compile on Android."targets": [{ "target_name": "spdlog", + "libraries": [ "-latomic" ], "sources": [ "src/main.cc", "src/logger.cc" ],
-
Save the file and quit text editor. You can do this by pressing
ESC
and thenwq
in Vim: -
Recompile spdlog using the following command:
$ npm install
-
(Optional) To see if spdlog works, run:
$ npm test
-
To fix the file search function of code-server, install
ripgrep
viapkg
and link it to the correct place:$ pkg install ripgrep -y $ cd ~/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/vscode-ripgrep/bin $ ln -s $(which rg) .
-
Finally, change the working directory back to home and start code-server with the following command:
$ cd ~ $ code-server --auth none --disable-telemetry
-
Now, you can open your browser and visit code-server at http://localhost:8080.
-
(Bonus) If you wish to visit this code-server from another device in the same local network, you can expose the HTTP service to all network interfaces by starting code-server with
--bind-addr
:$ code-server --bind-addr 0.0.0.0:8080 --disable-telemetry
You can find the password under
~/.config/code-server/config.yaml
:$ cat ~/.config/code-server/config.yaml
You may also need to enable HTTPS to enable clipboard and others features of Visual Studio Code in browsers. To do this, install
openssl-tool
and let code-server generate a certificate on startup:$ pkg install openssl-tool $ code-server --bind-addr 0.0.0.0:8080 --cert --disable-telemetry
You can get the public IP address of your device using the command below in Termux:
$ ifconfig
-
-
Save ppoffice/b9e88c9fd1daf882bc0e7f31221dda01 to your computer and use it in GitHub Desktop.
@Kingmir24 First cd into the code-server-4.4.0-linux-arm64
then CD into bin. view the directories with ls. And never call yourself fool. You just started learning.
Thanks... I will really appreciate
./code-server: 36: exec: /root/code-server-4.4.0-linux-arm64/lib/node: not found root@localhost:~/code-server-4.4.0-linux-arm64/bin#
Encounter same error code as @Adventuresofbot, checked and confirmed node (an executable) is present in the /root/code-…/lib directory.
Any ideas??
Probably need node extension? BTW note that it won't work as fluent VScode but its just an IDE to write code.
Probably need node extension? BTW note that it won't work as fluent VScode but its just an IDE to write code.
@Anonymous2716 thanks for your suggestion. Checked with node -v and confirmed node v12.22.9 was already installed on Ubuntu and yet ./code-server produces the same error message …
Understood this version of VSC is not a full-blown version, yet still nice to have the IDE 👍.
note that ripgrep path changed somehow, not sure why but this is the path that worked for me, @vscode/ripgrep instead of vscode-ripgrep
cd ~/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/@vscode/ripgrep/bin
Another easy method 😜
make sure you are using the latest version of termux 0.118. In google play the old version is not suitable
termux-setup-storage
pkg install proot-distro
(if it doesn't work, change the repository via termux-change-repo
)
proot-distro install ubuntu
proot-distro login ubuntu
pkg update
curl -fsSL https://code-server.dev/install.sh | sh
code-server --auth none
Then open your browser minimizing the termux and search on the Google search bar
http://127.0.0.1:8080
This method install last version (4.5.1 at the moment)
To install extensions that are not available in the extensions menu (for example, copilot and copilot labs), you need to download the extension in the VSIX format link and install it in the code-server via Extensions: Install from VSIX
in command palette
@radaevm awesome
- Do you do
pkg update
afterproot-distro login ubuntu
? - Try update system packages in Termux
pkg update -y
- are you using termux version 118?
- Look this
@radaevm step 1-3 are done and it still hasn't worked. I'm a noob but I'll try to make 4 work. Thanks, if you can explain in simple steps it would help me greatly if not then that's fine as well.
Are these all the commands which I have to give to termux, then VS code will be ready?
How to open local file and live server can anyone help me 😣
Another easy method 😜
termux-setup-storage
pkg install proot-distro
(if it doesn't work, change the repository viatermux-change-repo
)
proot-distro install ubuntu
proot-distro login ubuntu
pkg update
curl -fsSL https://code-server.dev/install.sh | sh
code-server --auth none
Then open your browser minimizing the termux and search on the Google search bar
http://127.0.0.1:8080
This method install last version (4.5.1 at the moment)
To install extensions that are not available in the extensions menu (for example, copilot and copilot labs), you need to download the extension in the VSIX format link and install it in the code-server via
Extensions: Install from VSIX
in command palette
hi, ill try and it works, but i cant paste text from other, what should i must to do with this ?, ill try search in google, but nothing, thanks
in this Ubuntu inside termux npm install does work. Even though I have node 18.9.0 installed and shows the version when I run the command. Any please help.
How to open local file and live server can anyone help me 😣
Exit termux and restart the process...
All extensions will start working
[1/4] Resolving packages...
[2/4] Fetching packages...
error code-server@4.7.1: The engine "node" is incompatible with this module. Expected version "16". Got "18.10.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
Got error,node version 16 is required but i have version 18
how to install version 16 or any other way to fix this
Use nodejs-lts
Use nodejs-lts
It gives error
Use nodejs-lts
It gives error
Just try this step below...
It's working perfectly. I'm currently using it.
-
termux-setup-storage
-
pkg install proot-distro
-
proot-distro install ubuntu
-
proot-distro login ubuntu
-
pkg update
-
curl -fsSL https://code-server.dev/install.sh | sh
-
code-server --auth none
Then open your browser minimizing the termux and search on the Google search bar http://127.0.0.1:8080
make sure you are using the latest version of termux 0.118. In google play the old version is not suitable
make sure you are using the latest version of termux 0.118. In google play the old version is not suitable
Yes i am on the latest version installed from fdroid
Use nodejs-lts
It gives error
Just try this step below... It's working perfectly. I'm currently using it.
- termux-setup-storage
- pkg install proot-distro
- proot-distro install ubuntu
- proot-distro login ubuntu
- pkg update
- curl -fsSL https://code-server.dev/install.sh | sh
- code-server --auth none
Then open your browser minimizing the termux and search on the Google search bar http://127.0.0.1:8080
Ubuntu 22.04 LTS
No standalone releases for armv8l.
Falling back to installation from npm.
Installing latest from npm.
sh: 426: NPM_PATH: not found
Installing with npm.
- npm install -g code-server --unsafe-perm
npm ERR! code 1
npm ERR! path /data/data/com.termux/files/usr/lib/node_modules/code-server npm ERR! command failed
npm ERR! command sh /tmp/postinstall-d374a316.sh
npm ERR! Failed to download cloud agent; --link will not work
npm ERR! Installing Code dependencies... npm ERR! You may not have the required dependencies to build the native modules.
npm ERR! Please see https://github.com/coder/code-server/blob/main/docs/npm.md
npm ERR! curl: (22) The requested URL returned error: 404 npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /data/data/com.termux/files/usr/lib/node_modules/code-server/lib/vscode/node_modules/keytar npm ERR! npm ERR! command failed npm ERR! npm ERR! command sh /tmp/install-7e7e01b5.sh
npm ERR! npm ERR! > keytar@7.9.0 build npm ERR! npm ERR! > node-gyp rebuild
npm ERR! npm ERR! gyp info it worked if it ends with ok
npm ERR! npm ERR! gyp info using node-gyp@9.0.0
npm ERR! npm ERR! gyp info using node@16.17.1 | android | arm
npm ERR! npm ERR! gyp info find Python using Python version 3.10.8 found at "/data/data/com.termux/files/usr/bin/python3"
npm ERR! npm ERR! gyp info spawn /data/data/com.termux/files/usr/bin/python3
npm ERR! npm ERR! gyp info spawn args [
npm ERR! npm ERR! gyp info spawn args '/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! npm ERR! gyp info spawn args '-f',
npm ERR! npm ERR! gyp info spawn args 'make',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/data/data/com.termux/files/usr/lib/node_modules/code-server/lib/vscode/node_modules/keytar/build/config.gypi',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/root/.cache/node-gyp/16.17.1/include/node/common.gypi',
npm ERR! npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/16.17.1',
npm ERR! npm ERR! gyp info spawn args '-Dnode_gyp_dir=/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/16.17.1/<(target_arch)/node.lib',
npm ERR! npm ERR! gyp info spawn args '-Dmodule_root_dir=/data/data/com.termux/files/usr/lib/node_modules/code-server/lib/vscode/node_modules/keytar',
npm ERR! npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! npm ERR! gyp info spawn args '--depth=.',
npm ERR! npm ERR! gyp info spawn args '--no-parallel',
npm ERR! npm ERR! gyp info spawn args '--generator-output',
npm ERR! npm ERR! gyp info spawn args 'build',
npm ERR! npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! npm ERR! gyp info spawn args ]
npm ERR! npm ERR! Package libsecret-1 was not found in the pkg-config search path.
npm ERR! npm ERR! Perhaps you should add the directory containinglibsecret-1.pc' npm ERR! npm ERR! to the PKG_CONFIG_PATH environment variable npm ERR! npm ERR! No package 'libsecret-1' found npm ERR! npm ERR! gyp: Call to 'pkg-config --cflags libsecret-1' returned exit status 1 while in binding.gyp. while trying to load binding.gyp npm ERR! npm ERR! gyp ERR! configure error npm ERR! npm ERR! gyp ERR! stack Error:
gyp` failed with exit code: 1
npm ERR! npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
npm ERR! npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! npm ERR! gyp ERR! System Linux 5.4.0-faked
npm ERR! npm ERR! gyp ERR! command "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! npm ERR! gyp ERR! cwd /data/data/com.termux/files/usr/lib/node_modules/code-server/lib/vscode/node_modules/keytar
npm ERR! npm ERR! gyp ERR! node -v v16.17.1
npm ERR! npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! npm ERR! gyp ERR! not ok
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /root/.npm/_logs/2022-10-18T13_32_03_711Z-debug-0.log
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /data/data/com.termux/files/usr/lib/node_modules/code-server/lib/vscode/extensions/node_modules/esbuild
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh /tmp/postinstall-8f7e646e.sh
npm ERR! npm ERR! Unsupported platform: android arm LE
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /root/.npm/_logs/2022-10-18T13_33_48_861Z-debug-0.log
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-10-18T13_30_44_363Z-debug-0.log
I get this error
@Adventuresofbot While running the code i get this error-
bin/sh : 1: g++: not found
@Adventuresofbot While running the code i get this error- bin/sh : 1: g++: not found
maybe you didn't install c-compiler before like clang
Somebody help out pls... I have been on it for the past 2 days now... I feel like I'm a fool