Node.js Setup Guide

Install and configure Node.js for AI development tools

Last updated: May 20, 2026

Why Node.js for AI?

What is Node.js?

Node.js is a JavaScript runtime that lets you run JavaScript code outside of a browser. Many modern AI tools (including Claude Code and OpenClaw) are built with Node.js because it's fast, cross-platform, and has a huge ecosystem of packages.

💡 Do you need this? If you're using Claude Code, OpenClaw, or any npm-based AI tools, yes! Python developers also benefit from Node.js for tooling and utilities.

1 Install Node.js via Homebrew (Recommended for Mac)

If you have Homebrew installed (see Homebrew Setup Guide), this is the easiest method:

Terminal
brew install node@20

This installs Node.js version 20 (LTS - Long Term Support), which is stable and recommended for production use.

Why LTS? LTS versions are tested, stable, and receive security updates for 3 years.

2 Alternative: Direct Download

If you prefer not to use Homebrew, download directly from the official site:

  1. Go to nodejs.org
  2. Click the green "LTS" download button
  3. Run the installer (.pkg for Mac, .msi for Windows)
  4. Follow the installation wizard

3 Verify Installation

Check that Node.js and npm (Node package manager) are installed:

# Check Node.js version
node --version
# Check npm version
npm --version

You should see output like:

v20.11.0
10.2.4

Optional: Install nvm (Node Version Manager)

nvm lets you install and switch between multiple Node.js versions. Useful if you work on projects that require different Node versions.

Terminal
brew install nvm

After installing, follow the setup instructions shown in your terminal to configure your shell.

⚠️ Note: For most users, a single LTS version is sufficient. Only install nvm if you need multiple Node versions.

Essential npm Commands

Command Description
npm install -g <package> Install package globally
npm install <package> Install package locally
npm list -g --depth=0 List globally installed packages
npm update -g <package> Update a global package
npm --version Check npm version

Troubleshooting

"command not found: node"

Node.js isn't installed or isn't in your PATH. Run brew install node@20 or download from nodejs.org.

Permission denied when installing packages

Don't use sudo! Fix npm permissions by running: mkdir ~/.npm-global && npm config set prefix '~/.npm-global'

Old Node.js version

Update with Homebrew: brew upgrade node@20

Official Resources

🚀 What's Next?

Now that Node.js is installed, you can install AI tools that depend on it:

← Back to All Guides Claude Code Setup →