Node.js Installation Guide
Install Node.js and npm for JavaScript development
10-15 minutes
Beginner
Cross-platform
Prerequisites
Before you begin:
- • Administrator access to your system
- • Internet connection for downloading Node.js
- • At least 1GB of available disk space
- • Windows 10+, macOS 10.15+, or Linux
Installation Methods
Recommended Method
Download the official installer from nodejs.org for the easiest setup.
✅ Easiest to install
✅ Includes npm
✅ Official support
Package Managers
Use your system's package manager for easier updates.
🔄 Easy updates
📦 System integration
⚡ Faster installation
Installation Steps
Windows Installation
Step 1: Download Node.js
- Visit the official Node.js website: nodejs.org
- Download the LTS (Long Term Support) version
- Choose the Windows Installer (.msi) for your system architecture (x64 recommended)
Step 2: Install Node.js
- Run the downloaded .msi installer as Administrator
- Follow the installation wizard
- Accept the default installation path
- Ensure "Add to PATH" is checked
- Complete the installation
Step 3: Verify Installation
node --version
npm --version
You should see version numbers for both Node.js and npm.
macOS Installation
Method 1: Official Installer
- Visit nodejs.org
- Download the macOS Installer (.pkg)
- Run the installer and follow the wizard
- Verify installation with terminal commands
Method 2: Using Homebrew (Recommended)
# Install Homebrew first (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js
brew install node
Linux Installation (Ubuntu/Debian)
Method 1: Using NodeSource Repository
# Update package list
sudo apt update
# Install curl
sudo apt install -y curl
# Add NodeSource repository
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# Install Node.js
sudo apt install -y nodejs
Method 2: Using Snap
sudo snap install node --classic
Method 3: Using Node Version Manager (nvm)
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Restart terminal or run
source ~/.bashrc
# Install latest LTS version
nvm install --lts
# Use the installed version
nvm use --lts
Verification
Test Your Installation
node --version
npm --version
# Test Node.js with a simple script
node -e "console.log('Hello from Node.js!')"
If you see version numbers and "Hello from Node.js!", your installation is successful!
Common Issues & Solutions
'node' is not recognized (Windows)
If you get this error after installation:
- Restart your command prompt or PowerShell
- Check if Node.js was added to PATH during installation
- Manually add Node.js to your system PATH if needed
Permission Errors (Linux/macOS)
If you get permission errors when installing global packages:
# Configure npm to use a different directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
# Add to PATH in your shell profile
export PATH=~/.npm-global/bin:$PATH
Next Steps
What to do next:
- • Create your first Node.js application
- • Learn about npm and package management
- • Explore popular Node.js frameworks (Express, Next.js)
- • Set up a development environment with VS Code