Node.js Installation

Node.js Installation

Node.js can be installed in 3 main ways:

โœ” Using Official Installer (Recommended)

โœ” Using Node Version Manager (NVM)

โœ” Using Package Manager (Linux)

Below is the step-by-step guide.


๐ŸŸข 1. Install Node.js on Windows (Recommended)

Step 1: Go to the official download page

๐Ÿ‘‰ https://nodejs.org

Step 2: Download LTS (Recommended) version

Example:
Node.js 20.x LTS

Step 3: Run the Installer

Double-click the .msi file and follow the steps:

  • Accept license

  • Choose installation directory

  • Keep default settings

  • Install Node.js + npm

Step 4: Check installation

Open CMD or PowerShell:

node -v
npm -v

If these show versions, Node.js is installed successfully.


๐Ÿ 2. Install Node.js on macOS

Option 1: Official Installer

Download .pkg file from:

๐Ÿ‘‰ https://nodejs.org

Then run the installer โ†’ next โ†’ next โ†’ finish.

Option 2: Install using Homebrew

brew install node

Check versions:

node -v
npm -v

๐Ÿง 3. Install Node.js on Linux (Ubuntu / Debian)

Update system:

sudo apt update

Install Node.js + npm:

sudo apt install nodejs npm -y

Check versions:

node -v
npm -v

๐Ÿ”„ 4. (Optional but Recommended) Install Node Version Manager (NVM)

NVM lets you install and switch between multiple Node.js versions.

Install NVM (Linux/macOS):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Restart terminal, then run:

nvm install --lts

Check version:

node -v

Install NVM for Windows

Download from:

๐Ÿ‘‰ https://github.com/coreybutler/nvm-windows/releases

Then install Node.js using:

nvm install 20
nvm use 20

๐Ÿงช Verify Node.js Installation

Create a file:

test.js

Add:

console.log("Node.js is working!");

Run:

node test.js

If it prints the message โ€” Node.js is successfully installed!

You may also like...