Installing Node.js
Node.js is a JavaScript runtime that lets you run JavaScript outside of a web browser.
What is Node.js?
Node.js Explained
Traditionally:
- JavaScript only ran in browsers
- You couldn't use JS for server-side tasks
- Limited to web pages only
With Node.js:
- Run JavaScript anywhere on your computer
- Build servers, tools, and scripts
- Access your file system
- Use thousands of free packages
In This Course:
| What We'll Use Node.js For |
|---|
| Running local development servers |
| Using build tools |
| Installing packages with npm |
| Running JavaScript utilities |
What is npm?
npm = Node Package Manager
When you install Node.js, you also get npm — a tool for installing pre-built code packages.
Think of npm as:
- An app store for code
- Contains millions of free packages
- One command installs complex tools
- Industry standard for JavaScript projects
Example Commands:
npm install prettier # Installs Prettier code formatternpm install tailwindcss # Installs Tailwind CSS frameworknpm install react # Installs React libraryYou'll use npm throughout your development career!
Installation Instructions
Choose your operating system:
# Windows Installation ## Step 1: Download1. Open your browser2. Go to: nodejs.org3. You'll see two download options: - LTS (Long Term Support) ← Choose this! - Current (newer but less stable)4. Click the LTS button (green)5. The .msi installer will download ## Step 2: Run Installer1. Find the downloaded file (e.g., node-v20.10.0-x64.msi)2. Double-click to run3. Click Next through the wizard4. Accept the license agreement5. Keep default installation path6. Keep default features selected7. IMPORTANT: Check "Automatically install necessary tools" if prompted8. Click Install9. Click Finish ## Step 3: Restart VS CodeIf VS Code is open, close and reopen it.This ensures VS Code recognizes the new installation.Verification
After installation, let's verify everything works.
Open Terminal in VS Code:
- Open VS Code
- Open Terminal: View → Terminal or press Ctrl/Cmd + `
Check Node.js Version:
node --versionExpected output (version numbers may vary):
v20.10.0
If you see a version number starting with v, Node.js is installed!
Check npm Version:
npm --versionExpected output:
10.2.3
If you see a version number, npm is installed!
Troubleshooting
Test npm
Let's verify npm works by checking what it can do:
npm helpYou should see a list of available npm commands.
Check Where Things Are Installed:
npm root -gThis shows where global packages are installed.
Version Reference
At time of writing, recommended versions:
| Software | Recommended Version |
|---|---|
| Node.js | v18.x or v20.x (LTS) |
| npm | v9.x or v10.x |
Don't worry if your versions are slightly different — as long as the commands work, you're good!
Installation Checklist
✅ Node.js Installation Verification
0/6Screenshot Your Success
Take a screenshot showing the terminal with both version commands working.
What You Can Do Now
With Node.js installed, you can:
1. Run JavaScript files directly:
node myfile.js2. Install packages globally:
npm install -g package-name3. Create projects with package management:
npm initnpm install some-package4. Use modern development tools that require Node.js
Lesson Summary
What You Accomplished:
- ✅ Understand what Node.js is (JavaScript runtime)
- ✅ Understand what npm is (package manager)
- ✅ Installed Node.js on your computer
- ✅ Verified installation with version checks
Why This Matters
Node.js is the foundation for modern JavaScript development. Many tools, frameworks, and workflows depend on it.
Knowledge Check
📝 Quiz
1/2What is Node.js used for?
Next Up
Let's install Git — the version control system for tracking and saving your code changes!