Node.js
backendnodejsGuideBeginner
Installing Node.js
Install and manage Node.js versions using Node Version Manager (nvm), Fast Node Manager (fnm), and package managers.
Verified: 2026-09-30
Tested on:node 22.x
Platforms:
linuxmacoswindows
#nodejs#nvm#fnm#installation#dev-environment
Release Channels: LTS vs Current
Node.js releases follow a predictable cycle:
- LTS (Long Term Support): Recommended for most users and production servers. Offers stability, bug fixes, and critical security patches for 30 months.
- Current: Includes the latest features, experimental APIs, and modern JavaScript syntax updates.
Recommended: Using a Version Manager
Using a Node version manager allows you to switch between multiple Node versions per project without permission issues (sudo).
1. Fast Node Manager (fnm) (Cross-Platform & Ultra-Fast)
fnm is built in Rust and works seamlessly across macOS, Linux, and Windows:
# macOS / Linux via Homebrew
brew install fnm
# Windows via Winget
winget install Schniz.fnmInstall and activate LTS:
fnm install --lts
fnm use --lts
fnm default --lts2. Node Version Manager (nvm) (macOS & Linux)
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bashInstall the latest LTS:
nvm install --lts
nvm use --lts
nvm alias default 'lts/*'Verifying the Installation
Check the installed versions of Node.js and its default package manager:
node -v
# Output example: v22.11.0
npm -v
# Output example: 10.9.0Enabling Modern Corepack (pnpm & Yarn)
Node.js includes Corepack, a zero-install tool to manage package managers like pnpm and yarn:
# Enable corepack
corepack enable
# Activate pnpm
corepack enable pnpm
pnpm --version