How to run java script Language node.js on command line Andoid termux [Also work for non-rooted Devices]

in #utopian-io8 years ago (edited)

What Will I Learn?

  • How to install nodemon in Termux
  • How to setup nodemon in Termux
  • How to create a javascript file and where to save it
  • How to run the .js file in Termux using commands

Requirements

Difficulty

  • Intermediate

Procedure

How to install & setup nodemon in Termux
  • 1: Open the Termux app and type command pkg update && pkg upgrade && pkg install python2 and press Enter.

1.png

  • 2: Now type command apt install coreutils and press Enter, wait until it complete its process.
    util.png

  • 3: Now type command termux-setup-storage and press Enter, then if a popup comes, click on "Allow".storage.png

  • 4: Now go to a directory by typing command cd storage/shared/Android/data/com.termux/files and press Enter

cd.png

  • 5: Now make a directory by type the command mkdir nodejstuts and press Enter
    mkdir.png
  • 6: Now open this directory by type the command cd nodejstuts

cd node.png

  • Now type command npm install -g nodemon and press Enter, make sure you have a good internet connection and received the same msg at the end of installation as shown in this screenshot.

-g.png

  • Message at the End of Installation

newer.png

How to create a server.js file.
  • This is a Testing Example. You can create any file with javascript if you are expert in JavaScript.
  • 1: First Run the Amaze file manager and create a file named server.js in directory storage>emulated>Android>data>com.termux>files>nodejstuts
  • Create a new file named server.js (You can choose any name with .js extension, after that you run it with that name)
    new file.png
  • In my case, i named it server.js

file name.png

  • 2: Now open the nod/node.js app and click on add file
    add file.png

  • 3: Select you last created the file by going to same directory Android>data>com.termux>file>nodejstuts and select the file server.js You can also follow these screenshots

  • open Android
    1android.png

  • open data

2data.png

  • search folder named com.termux and open it
    3com.png
  • open files
    4 file.png
  • open nodejstuts
    5 node.png
  • click on server.js

6server.png

  • 3: Now click on open
    open server.png
  • 4: Write your code and save it
    code.png
  • Save it
    save.png
  • 5: Now back to Termux and type command nodemon server.js

nodemon server.png

  • All Done! Your .js file run
    run done.png

Curriculum

How to setup and run python and C++ in Android Termux

Tutorial 1: How to download, Install, Run and Use Fish-shell in Termux [Also work for non-rooted devices]

Tutorial 2: How to make a call and send SMS using Android Termux

Tutorial 3: How to install SQLmap in Android Termux [Also work for non-rooted devices]

Tutorial 4: How to Trace exact IP Location on Android Termux [Also work for non-rooted devices]



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

  • it's considered trival
  • it's just an installation tutorial

You can contact us on Discord.
[utopian-moderator]

Hey @creon, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Good job my fri...

Coin Marketplace

STEEM 0.13
TRX 0.34
JST 0.036
BTC 108529.70
ETH 4405.54
USDT 1.00
SBD 0.82