Node.js
Node.js is a JavaScript runtime required for many command-line AI tools and MCP servers. This guide covers installation across different platforms.
When do you need Node.js?
Anything that uses npm or node requires Node.js.
For example:
- Claude Code - Required for the CLI tool itself (22+ LTS)
- Gemini CLI tools - Required for most community CLI implementations (22+ LTS)
- Running the MCP server via
npm.
System Requirements
- Operating Systems: Windows 10+, macOS 10.15+, Linux (Ubuntu 18.04+)
- Architecture: x64, ARM64 (Apple Silicon supported)
- Disk Space: ~50MB for Node.js, additional space for packages
Installation Methods
Recommended Version
Always install the LTS (Long Term Support) version for stability and long-term support. As of this writing, that's Node.js 22.x.
macOS Installation
Option 1: Official Installer (Recommended)
Download the installer:
- Visit nodejs.org
- Click "Download Node.js (LTS)"
- Download the
.pkgfile for macOS
Install Node.js:
- Double-click the downloaded
.pkgfile - Follow the installation wizard
- Enter your password when prompted
- Double-click the downloaded
Verify installation:
node --version npm --version
Option 2: Using Homebrew
If you have Homebrew installed:
# Install Node.js
brew install node
# Verify installation
node --version
npm --version
Option 3: Using Version Manager
For developers who need multiple Node.js versions, use a version manager like nvm, n, fnm, volta, or asdf.
Since version managers are a matter of personal preference, consider reviewing the version manager documentation for your specific needs.
Windows Installation
Option 1: Official Installer (Recommended)
Download the installer:
- Visit nodejs.org
- Click "Download Node.js (LTS)"
- Download the
.msifile for Windows
Install Node.js:
- Run the downloaded
.msifile - Follow the installation wizard
- Important: Check "Add to PATH" during installation
- Run the downloaded
Verify installation:
node --version npm --version
Option 2: Using Windows Package Manager
If you have Windows Package Manager (winget):
# Install Node.js (run in PowerShell)
winget install OpenJS.NodeJS
# Verify installation
node --version
npm --version
Option 3: Using Chocolatey
If you have Chocolatey installed:
# Install Node.js (run as Administrator)
choco install nodejs
# Verify installation
node --version
npm --version
Linux Installation
Ubuntu/Debian
Option 1: Official Repository (Recommended)
# Download and import the Nodesource GPG key
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
# Add the NodeSource repository
echo "deb https://deb.nodesource.com/node_lts.x $(lsb_release -s -c) main" | sudo tee /etc/apt/sources.list.d/nodesource.list
# Update package index
sudo apt update
# Install Node.js
sudo apt install nodejs
# Verify installation
node --version
npm --version
Option 2: Ubuntu's Default Repository
# Update package index
sudo apt update
# Install Node.js and npm
sudo apt install nodejs npm
# Verify installation
node --version
npm --version
CentOS/RHEL/Fedora
Fedora/Recent CentOS:
# Install Node.js and npm
sudo dnf install nodejs npm
# Verify installation
node --version
npm --version
Older CentOS/RHEL:
# Install Node.js and npm
sudo yum install nodejs npm
# Verify installation
node --version
npm --version
Arch Linux
# Install Node.js and npm
sudo pacman -S nodejs npm
# Verify installation
node --version
npm --version
Post-Installation Setup
Update npm
After installing Node.js, update npm to the latest version:
npm install -g npm@latest
Configure npm (Optional)
Set up global package installation directory to avoid permission issues:
macOS/Linux
# Create directory for global packages
mkdir ~/.npm-global
# Configure npm to use the new directory
npm config set prefix '~/.npm-global'
# Add to your shell profile
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
# Reload your shell profile
source ~/.bashrc
Windows
# Create directory for global packages
mkdir "%USERPROFILE%\npm-global"
# Configure npm to use the new directory
npm config set prefix "%USERPROFILE%\npm-global"
# Add to PATH (System Properties > Environment Variables)
# Add %USERPROFILE%\npm-global to your PATH
Verification
After installation, verify everything is working correctly:
# Check Node.js version (should be 22.x LTS or higher)
node --version
# Check npm version
npm --version
# Test Node.js
node -e "console.log('Node.js is working!')"
# Test npm by installing a test package
npm install -g hello-world-npm
hello-world
npm uninstall -g hello-world-npm
Troubleshooting
Common Issues
1. "node: command not found"
# Check if Node.js is in PATH
which node
# If not found, add to PATH or reinstall
export PATH=$PATH:/usr/local/bin
2. Permission errors with npm
# Fix npm permissions (avoid using sudo)
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
3. Old version installed
# Check current version
node --version
# Update Node.js (download latest installer)
# Or use version manager like nvm
4. Windows PATH issues
- Restart Command Prompt/PowerShell after installation
- Check PATH in System Properties > Environment Variables
- Ensure Node.js installation directory is in PATH
Security Considerations
npm Security Best Practices
- Regularly update npm:
npm install -g npm@latest - Regularly update the
whoisxmlapipackage:npm update -g @whoisxmlapidotcom/mcp-whoisxmlapi
Next Steps
Once Node.js is installed, you can proceed with:
- Claude Code installation - Complete setup with MCP integration
- Gemini CLI tools installation - Set up Google AI command-line tools
Getting Help
If you encounter issues: