Node.js in Termux – Installation & Basic Commands

Node.js is a tool that helps you run JavaScript code on your phone using Termux. Normally, JavaScript works inside a browser, but Node.js lets you run it like a normal program. You can use it to create small apps, simple servers, and useful tools directly on your Android phone in an easy way.

Installation Commands

Update and upgrade termux packages:

pkg update && pkg upgrade -y

Install Nodejs:

pkg install nodejs -y

Check Nodejs installation version:

node -v

Check npm version (Nodejs package Installer):

npm -v

Basic Commands

Open Node.js interactive mode:

node

Run JavaScript directly:

console.log("Hello Termux Node.js");

Exit Node.js:

.exit

Create a JavaScript file:

nano file_name.js

Run a JavaScript file:

node file_name.js

Initialize a Node.js project:

npm init -y

Install Express:

npm install express

Install Axios:

npm install axios

Install Nodemon globally:

npm install -g nodemon
READ ALSO  Top 20 Essential Termux Commands for New Users

Leave a Comment