Lesson 0: Setting Up Your Development Environment
What You'll Learn
In this lesson, you'll set up everything you need to start programming with Node.js and JavaScript on your macOS computer.
Why This Matters
Before you can write code, you need the right tools. Think of it like cooking - you need a kitchen with proper equipment before you can make a meal. We'll install:
- Node.js: The engine that runs JavaScript code on your computer
- Visual Studio Code (VS Code): A text editor designed for writing code
Step 1: Installing Node.js
What is Node.js?
Node.js lets you run JavaScript code on your computer (not just in a web browser). It's like having an interpreter that understands the JavaScript language.
Installation Steps:
- Open your web browser and go to: https://nodejs.org/en/download
- Download the LTS version (LTS means "Long Term Support" - it's the stable, recommended version)
- Click the big green button that says "Download for macOS"
- Run the installer
- Open the downloaded
.pkgfile - Follow the installation wizard (click "Continue" and "Agree" to the terms)
- Enter your Mac password when prompted
- Open the downloaded
- Verify the installation
- Open the Terminal app (you can find it in Applications → Utilities, or search for it using Spotlight)
- Type this command and press Enter:
node --version
- You should see something like
v20.10.0(the numbers might be different) - Also check npm (Node Package Manager) by typing:
npm --version
- You should see a version number like
10.2.3
What Did We Just Install?
- node: The JavaScript runtime (the engine)
- npm: Node Package Manager - a tool for installing additional code libraries (like an app store for code)
Step 2: Installing Visual Studio Code
What is VS Code?
VS Code is a code editor - a special text editor designed for writing programs. It has features like:
- Syntax highlighting (colors your code to make it easier to read)
- Auto-completion (suggests code as you type)
- Error detection (shows you mistakes before you run the code)
Installation Steps:
- Go to: https://code.visualstudio.com/
- Download the macOS version
- Open the downloaded file (a
.zipfile) - Drag the VS Code icon to your Applications folder
- Open VS Code from Applications
- Optional but recommended: Add VS Code to your dock for easy access
First-Time Setup:
When you open VS Code for the first time:
- You might see a welcome screen - feel free to explore it
- The interface has several sections:
- Explorer (left side): Shows your files and folders
- Editor (center): Where you write code
- Terminal (bottom): Command line inside VS Code
Step 3: Creating Your First Project Folder
Why Use a Project Folder?
Keeping your code organized in folders (called "projects") helps you manage your files and makes it easier to work with multiple programs.
Steps:
- Create a folder for your programming lessons:
- In VS Code, go to File → Open Folder
- Navigate to where you want to create your projects (like Documents)
- Click "New Folder" and name it
node-lessons - Click "Open"
- Create a subfolder for your first project:
- In VS Code's Explorer panel (left side), click the "New Folder" icon
- Name it
lesson-01
Step 4: Installing Helpful VS Code Extensions
Extensions add extra features to VS Code. Here are some helpful ones for JavaScript development:
- Open Extensions panel: Click the Extensions icon on the left sidebar (or press Cmd+Shift+X)
- Search and install these extensions:
- ESLint: Helps find errors and enforce code style
- Prettier - Code formatter: Automatically formats your code to look clean
- Path Intellisense: Auto-completes file paths
- Code Runner: Lets you quickly run code with a button
To install: Click on the extension name, then click the "Install" button.
Summary
You now have:
- ✅ Node.js installed (the JavaScript runtime)
- ✅ npm installed (package manager for installing libraries)
- ✅ VS Code installed (your code editor)
- ✅ A project folder created
- ✅ Helpful VS Code extensions installed
What's Next?
In the next lesson, you'll write your first JavaScript program and learn about basic programming concepts like variables and console output.
Troubleshooting
If Node.js didn't install:
- Make sure you downloaded the macOS version
- Try restarting your computer after installation
- Check that you have enough disk space
If VS Code won't open:
- Right-click the app and select "Open" (macOS security feature)
- Go to System Preferences → Security & Privacy and allow it