Installing Node.js

JavaScript was originally designed to run only in web browsers. Node.js changed that by creating a runtime that lets JavaScript run anywhere — on servers, on your laptop, in command-line tools.

While Python is our primary teaching language, you'll encounter JavaScript throughout web development. Installing Node.js now means you're ready for those moments and can see how the same concepts look in different languages.

What Comes With Node.js

When you install Node.js, you get two tools:

  • node: The runtime that executes JavaScript code
  • npm: The Node Package Manager, which installs libraries and tools

Both are essential for modern web development.

Choosing a Version

Node.js offers two release types:

  • LTS (Long Term Support): Stable, recommended for most users
  • Current: Latest features, but may have rough edges

Choose LTS. It's what most tutorials and tools expect, and it receives security updates for years.

Installing Node.js

  1. Visit nodejs.org
  2. Download the LTS version (the button on the left)
  3. Run the installer and accept the defaults

Verify in a new PowerShell or Command Prompt window:

node --version
npm --version

Option 1: Using Homebrew (recommended)

brew install node

Option 2: Direct download
Visit nodejs.org and download the macOS LTS installer.

Verify the installation:

node --version
npm --version

The recommended approach is using nvm (Node Version Manager), which lets you install and switch between Node versions easily:

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# Restart your terminal, then install Node nvm install --lts

Alternatively, use your distribution's package manager, though versions may be older:

# Debian/Ubuntu
sudo apt install nodejs npm

Verifying Your Installation

If both commands return version numbers, you're set. The exact numbers don't matter as long as they're reasonably recent.

Why Both Python and Node?

Having both installed lets you see how programming concepts transcend individual languages. A loop is a loop whether it's Python or JavaScript. Understanding this transferability is key to becoming a confident developer.

See More

You need to be signed in to leave a comment and join the discussion