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
-
Visit the Node.js website
- Go to https://nodejs.org
-
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
-
Run the installer
- Open the downloaded
.pkgfile - Follow the installation wizard
- Click "Continue" → "Agree" → "Install"
- Enter your Mac password when prompted
- Open the downloaded
-
Verify installation
node --version # Should show: v20.x.x or v22.x.x npm --version # Should show: 10.x.x or higher
For Windows
-
Visit the Node.js website
- Go to https://nodejs.org
-
Download the LTS version
- Click the big green button that says "LTS"
- Download the Windows Installer (.msi file)
-
Run the installer
- Open the downloaded
.msifile - Follow the installation wizard
- Accept the license agreement
- Keep all default settings
- Click "Next" through all steps
- Click "Install" (might need admin approval)
- Open the downloaded
-
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:
- Node.js was added to your computer
- npm was installed alongside it
- 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
- Close your terminal/command prompt completely
- Open a new one
- Try the verification commands again
Old version showing
Solution: You might have an old version installed
- Uninstall the old version first
- Then install the new version
- Restart your terminal
Windows: npm not recognized
Solution: Check if Node.js is in your PATH
- Search for "Environment Variables" in Start Menu
- Click "Edit the system environment variables"
- Click "Environment Variables" button
- Look for "Path" in System Variables
- 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?
-
Node.js Official Docs: https://nodejs.org/docs
- When to use: When you want to understand Node.js deeply
-
npm Documentation: https://docs.npmjs.com
- When to use: When you need to understand how npm works
For now, just knowing how to install it is enough. You'll learn by doing!