How to install nodejs on android step by step
Basic Information
Equipment:Samsung Galaxy M30s
Android version:11
Kernel version:4.14.113-22430363
App name:Termux
App version:0.117
Here is the tutorial
1. Install Termux from Play Store or other app markers or github where you can find the latest version .
2. Open the Termux
3. Working with Codes
pkg upgrade //This is not necessary.
pkg install nodejs //This will install node and npm programs in your termux.
PS:With pkg install <package>you can try other packages you want to install.
How to run a nodejs script
Run commands:
1. termux-setup-storage //Get phone storage access.This will generate a storage folder under the termux directory.
2. cd storage //Go to the storage folder.
3. ls //List of subdirectories under the folder,for me, downloads which corresponds to Download in my phone. So, before you can run a nodejs script in termux, copy it to the Download folder.
4. cd downloadsthencd node // node is my nodejs script folder name.
5. Run node command such as node local.js to run your script.
PS:My phone is not rooted, so I usually run the npm install command in my nodejs script folder on the PC, then copy the folder to the Download folder in my phone, and then use the node command in termux to run the nodejs script.It is worth mentioning that the version of node on the PC should be the same as the version in termux or lower than it. You can run node -vto see the version.