Skip to content

Node.js Environment

Node.js lets you run JavaScript outside the browser — on servers, desktops, and IoT devices.

flowchart TD
A["📄 app.js"] --> B["🖥️ Node.js"]
B --> C["⚙️ V8 Engine"]
C --> D["📁 File System"]
C --> E["🌐 HTTP Module"]
C --> F["🔌 Streams"]
C --> G["📦 npm Packages"]
style B fill:#059669,color:#fff
style G fill:#cb3837,color:#fff
  1. Go to nodejs.org
  2. Download the LTS version
  3. Run the installer
  4. Verify:
Terminal window
node --version # e.g., v22.x.x
npm --version # e.g., 10.x.x
Terminal window
# Run a file
node app.js
# Open the REPL (interactive shell)
node
> console.log("Hello from Node.js!")
> .exit
// app.js — server-side JavaScript
const fs = require("fs");
fs.writeFileSync("hello.txt", "Hello from Node.js!");
console.log("File created!");
Terminal window
node app.js
# File created!
# Check your directory — hello.txt exists!