Skip to main content

Install Node.js

Coding tools like Claude Code, Codex and Gemini CLI need Node.js 18 or later. If you already have it, you can skip this page.

Check your version

Run node -v in your terminal. If it shows v18.x.x or higher, you're all set.

Windows

Option 1: official installer (recommended)

  1. Download the LTS Windows Installer (.msi) from the Node.js website
  2. Run it with the default settings
  3. It adds Node.js to your PATH for you

Option 2: package manager

# Winget (Windows 11 / Windows 10)
winget install OpenJS.NodeJS.LTS

# Chocolatey
choco install nodejs-lts

# Scoop
scoop install nodejs-lts

macOS

Option 1: Homebrew (recommended)

# Install Homebrew if needed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install Node.js
brew install node

Option 2: official installer

Download the LTS .pkg installer from the Node.js website and run it.

Linux

Ubuntu / Debian

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

CentOS / RHEL

curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejs

Fedora

sudo dnf install -y nodejs npm

Arch Linux

sudo pacman -S nodejs npm

Use nvm (for advanced users)

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
source ~/.bashrc

# Install and use Node.js LTS
nvm install --lts
nvm use --lts
nvm alias default node

Check the install

node --version   # Should show v18.x.x or higher
npm --version    # Should show npm version

Troubleshooting

"command not found" error

  • Restart your terminal
  • Check that the Node.js folder is on your PATH
  • Restart your computer and try again

Permission errors (macOS / Linux)

If a global npm install fails with a permission error, point npm at a folder in your home directory:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Next steps

Now set up a coding tool: