Step 1: Download Node.js

  • Visit the official website: https://nodejs.org/
  • Choose LTS (Long-Term Support) version for stability.

Step 2: Verify Installation

After installation, open Command Prompt (Windows) or Terminal (Mac/Linux) and run:

node -v   # Check Node.js version

npm -v    # Check NPM version

Running JavaScript in Node.js

  1. Create a new file app.js
  2. Add the following code:

console.log(“Welcome to Node.js!”);

  1. Run the file using:

node app.js

Output: Welcome to Node.js!