Node.js5 min read
Installing Node.js and npm
Learn how to install Node.js and npm on Windows, Mac, and Linux. Understand version management with nvm.
Sarah Chen
December 19, 2025
0.0k0
Installing Node.js and npm
npm comes bundled with Node.js. Install Node.js, get npm free.
Method 1: Direct Download (Easiest)
- Go to nodejs.org
- Download LTS version (recommended)
- Run installer
- Done!
Verify installation:
node --version
# v20.10.0
npm --version
# 10.2.3
Method 2: Using nvm (Recommended)
nvm (Node Version Manager) lets you install multiple Node.js versions.
Install nvm (Mac/Linux):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
Install nvm (Windows):
Download nvm-windows from GitHub releases.
Using nvm:
# Install latest LTS
nvm install --lts
# Install specific version
nvm install 18.17.0
# List installed versions
nvm ls
# Switch version
nvm use 18.17.0
# Set default
nvm alias default 18.17.0
LTS vs Current
| Version | Use Case |
|---|---|
| LTS (Long Term Support) | Production, stability |
| Current | Latest features, testing |
Recommendation: Use LTS for real projects.
Verify Everything Works
# Check Node.js
node --version
# Check npm
npm --version
# Run a quick test
node -e "console.log('Node.js is working!')"
Common Issues
Permission errors on npm (Mac/Linux):
# Fix: Use nvm or change npm default directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
# Add to .bashrc: export PATH=~/.npm-global/bin:$PATH
Multiple versions conflict:
# Use nvm to manage versions
nvm use 18
# Now using Node.js v18
Key Takeaway
Use nvm to install Node.js - it makes version management painless. Download LTS for stability, Current for experimenting. Once installed, you're ready to build!
#Node.js#npm#Installation#Beginner