Installing Node.js

Node.js is a JavaScript runtime that lets you run JavaScript code on your computer (outside of a web browser). npm (Node Package Manager) comes bundled with Node.js and helps you install and manage code libraries.

What You're Installing

  • Node.js: The JavaScript runtime
  • npm: Package manager (installs automatically with Node.js)

Why We Need This

Our website is built with Next.js, which requires Node.js to run the development server, build the site, and manage dependencies.

Installation Steps

For Mac

  1. Visit the Node.js website

  2. Download the LTS version

    • Click the big green button that says "LTS" (Long Term Support)
    • LTS versions are more stable and recommended
    • Current LTS: v20.x or v22.x
  3. Run the installer

    • Open the downloaded .pkg file
    • Follow the installation wizard
    • Click "Continue" → "Agree" → "Install"
    • Enter your Mac password when prompted
  4. Verify installation

    node --version
    # Should show: v20.x.x or v22.x.x
    
    npm --version
    # Should show: 10.x.x or higher
    

For Windows

  1. Visit the Node.js website

  2. Download the LTS version

    • Click the big green button that says "LTS"
    • Download the Windows Installer (.msi file)
  3. Run the installer

    • Open the downloaded .msi file
    • Follow the installation wizard
    • Accept the license agreement
    • Keep all default settings
    • Click "Next" through all steps
    • Click "Install" (might need admin approval)
  4. Verify installation

    • Open Command Prompt (search for "cmd" in Start Menu)
    node --version
    # Should show: v20.x.x or v22.x.x
    
    npm --version
    # Should show: 10.x.x or higher
    

Understanding the Installation

What Just Happened?

When you installed Node.js:

  1. Node.js was added to your computer
  2. npm was installed alongside it
  3. Both were added to your system PATH (so you can run them from anywhere)

What is npm?

npm is like an app store for code. Instead of writing every piece of code yourself, you can use npm to download and use code that others have written (called "packages" or "libraries").

For example:

  • Next.js (our framework)
  • React (our UI library)
  • Tailwind CSS (our styling tool)

All of these are installed via npm!

Common Issues

"command not found" after installation

Solution: Restart your terminal

  1. Close your terminal/command prompt completely
  2. Open a new one
  3. Try the verification commands again

Old version showing

Solution: You might have an old version installed

  1. Uninstall the old version first
  2. Then install the new version
  3. Restart your terminal

Windows: npm not recognized

Solution: Check if Node.js is in your PATH

  1. Search for "Environment Variables" in Start Menu
  2. Click "Edit the system environment variables"
  3. Click "Environment Variables" button
  4. Look for "Path" in System Variables
  5. It should include something like C:\Program Files\nodejs\

Testing Your Installation

Let's make sure everything works:

# Check Node.js version
node --version

# Check npm version
npm --version

# Run a simple Node.js command
node -e "console.log('Hello from Node.js!')"
# Should print: Hello from Node.js!

If all three work, you're ready! ✅

What's Next?

Node.js is installed! Now let's install a code editor.

Next: Installing Visual Studio Code →


External Resources

Want to learn more about Node.js?

For now, just knowing how to install it is enough. You'll learn by doing!