Module 0.2: Setting Up Your Development Environment

🎯 Learning Objectives
Upon completing this module, you’ll be able to:
- Set up and configure Node.js using nvm for managing multiple versions.
- Install Git and configure SSH connectivity with GitHub.
- Customize Visual Studio Code with essential extensions for React development.
- Master basic Terminal/Command Line operations.
- Install and utilize React Developer Tools within your browser.
1. Node.js & npm
1.1. Check Your Current Environment
Before diving into installation, let’s see if Node.js is already on your machine.
For all platforms:
node -v
npm -vWhat to expect:
- If installed: You’ll see the version numbers (e.g.,
v20.10.0,10.2.3). - If not installed: You’ll get an error like
command not foundor'node' is not recognized.
1.2. Direct Installation (Beginner)
Windows
- Head over to https://nodejs.org .
- Download the LTS (Long Term Support) version – this is the recommended choice for production.
- Run the installer (.msi file) and stick with the default options.
- Restart your terminal after the installation is complete.

[Screenshot]
Description: A screenshot of the nodejs.org homepage, highlighting the green “LTS” download button. The text “Recommended For Most Users” is emphasized.
macOS
Option 1: Download the Installer
- Visit https://nodejs.org .
- Download the LTS version for macOS (.pkg file).
- Run the installer and follow the on-screen prompts.
Option 2: Homebrew (Recommended)
# Install Homebrew if you don't have it yet
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js
brew install nodeLinux (Ubuntu/Debian)
# Update your package list
sudo apt update
# Install Node.js using the NodeSource repository for the latest versions
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# Verify the installation
node -v
npm -v1.3. Node Version Manager - nvm (Recommended)
Why You Need nvm
In the real world, different projects often require specific Node.js versions. Imagine this scenario:
| Project | Required Node Version |
|---|---|
| Legacy Project A | Node 16.x |
| Current Project B | Node 18.x |
| New Project C | Node 20.x |
nvm (Node Version Manager) is your key to managing this complexity. It allows you to:
- Install multiple Node.js versions on a single machine.
- Seamlessly switch between versions with a single command.
- Automatically switch versions when you enter a project directory using an
.nvmrcfile.
Installing nvm
macOS / Linux:
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# Reload your shell configuration
source ~/.bashrc # If you use bash
source ~/.zshrc # If you use zsh
# Verify installation
nvm --versionWindows (nvm-windows):
- Go to: https://github.com/coreybutler/nvm-windows/releases
- Download the
nvm-setup.exefile from the Assets section. - Run the installer with Administrator privileges.
- Restart your terminal.
# Verify installation
nvm versionEssential nvm Commands
# List available Node.js versions to install
nvm list-remote # macOS/Linux
nvm list available # Windows
# Install the latest LTS Node.js version
nvm install --lts
# Install a specific Node.js version
nvm install 20
nvm install 18.19.0
# See which Node.js versions you have installed
nvm list # or: nvm ls
# Switch to a different Node.js version
nvm use 20
nvm use 18
# Set a default Node.js version
nvm alias default 20 # macOS/Linux
nvm alias default 20 # Windows: this is set during installation
# Check your current active Node.js version
nvm current
The .nvmrc File - Automatic Version Switching
Create an .nvmrc file in your project’s root directory to automatically switch Node versions:
# Create .nvmrc with a Node version
echo "20" > .nvmrc
# Or with a specific version
echo "20.10.0" > .nvmrcWhen you cd into your project directory, simply run:
nvm use
# Output: Found '.nvmrc' with version <20>
# Now using node v20.x.xAutomation (Optional): Add this to your ~/.zshrc or ~/.bashrc file for automatic loading:
# Auto-load .nvmrc
autoload -U add-zsh-hook
load-nvmrc() {
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$(nvm version)" ]; then
nvm use
fi
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc1.4. Validate Your Installation
Let’s make sure all your tools are up and running:
node -v
# Expected: v20.x.x (or the version you installed)
npm -v
# Expected: 10.x.x
npx -v
# Expected: 10.x.x (usually matches your npm version)1.5. Troubleshooting
| Error Message | Potential Cause | Solution |
|---|---|---|
command not found: node | Node.js not added to PATH | Restart your terminal or verify your PATH environment variable. |
nvm: command not found | Shell hasn’t loaded nvm | Run source ~/.bashrc or source ~/.zshrc. |
npm ERR! EACCES | Permission denied | Use nvm instead of global installation, or fix npm permissions. |
node: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_X.XX' not found | Outdated Linux distribution | Upgrade your OS or use an older Node.js version compatible with your distro. |
2. Git & GitHub
2.1. Installing Git
Windows
- Visit https://git-scm.com/download/win .
- Download and run the installer.
- Pay attention to these crucial installation options:
- Default editor: Select VS Code (if you’ve installed it).
- PATH environment: Choose “Git from the command line and also from 3rd-party software.”
- Line ending: Select “Checkout Windows-style, commit Unix-style line endings.”
macOS
# Option 1: Xcode Command Line Tools (automatically installs Git)
xcode-select --install
# Option 2: Homebrew
brew install gitLinux (Ubuntu/Debian)
sudo apt update
sudo apt install gitVerify:
git --version
# Expected: git version 2.x.x2.2. Configuring Git
Set up your user information (this is mandatory before you can commit):
# Configure your name
git config --global user.name "Your Name"
# Configure your email (must match your GitHub email)
git config --global user.email "you@example.com"2.3. Creating a GitHub Account
- Go to https://github.com .
- Click “Sign up” and fill in your details:
- Email (use the same one you configured in Git).
- Password (make it strong: mix of uppercase, lowercase, numbers, and symbols).
- Username (this will be part of your profile URL).
- Verify your email address.
2.4. Setting Up Your SSH Key
An SSH key allows you to connect to GitHub securely without typing your password every time you push or pull.
Step 1: Check for Existing SSH Keys
ls -la ~/.ssh
# Look for files named id_ed25519.pub or id_rsa.pubStep 2: Generate a New SSH Key (if you don’t have one)
# Generate an SSH key using the Ed25519 algorithm (recommended)
ssh-keygen -t ed25519 -C "you@example.com"
# Press Enter to accept the default file path
# Enter a passphrase (optional but highly recommended for security)Step 3: Add Your SSH Key to the ssh-agent
macOS/Linux:
# Start the ssh-agent
eval "$(ssh-agent -s)"
# Add your SSH key
ssh-add ~/.ssh/id_ed25519Windows (Git Bash):
# Start the ssh-agent
eval $(ssh-agent -s)
# Add your SSH key
ssh-add ~/.ssh/id_ed25519Step 4: Add Your SSH Key to GitHub
-
Copy your public key:
# macOS pbcopy < ~/.ssh/id_ed25519.pub # Linux cat ~/.ssh/id_ed25519.pub # Manually copy the output # Windows (Git Bash) clip < ~/.ssh/id_ed25519.pub -
On GitHub:
- Go to Settings → SSH and GPG keys → New SSH key.
- Title: Give it a descriptive name (e.g., “MacBook Pro Work”).
- Key type: Authentication Key.
- Key: Paste the public key you copied.
- Click Add SSH key.

Step 5: Test Your Connection
ssh -T git@github.comSuccessful Output:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.2.5. Troubleshooting Git/SSH Issues
| Error | Potential Cause | Solution |
|---|---|---|
Permission denied (publickey) | SSH key not added to GitHub | Double-check Step 4. |
Could not open a connection to your authentication agent | ssh-agent is not running | Run eval "$(ssh-agent -s)". |
fatal: not a git repository | Git not initialized in the folder | Run git init in your project folder. |
3. Visual Studio Code
3.1. Installing VS Code
- Visit https://code.visualstudio.com .
- Download the version for your operating system.
- Follow the installation instructions.
macOS (Homebrew):
brew install --cask visual-studio-codeLinux (Ubuntu/Debian):
# Download and install from the .deb package
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code3.2. Essential Extensions
Open VS Code and install these extensions via the Command Palette (Ctrl+Shift+X / Cmd+Shift+X):
| Extension | ID | Description |
|---|---|---|
| Reactjs Code Snippets | xabikos.reactsnippets | Snippets for React (e.g., rafce, useState, useEffect…) |
| Prettier - Code formatter | esbenp.prettier-vscode | Automatically formats your code. |
| ESLint | dbaeumer.vscode-eslint | Catches JavaScript/TypeScript errors. |
| Auto Rename Tag | formulahendry.auto-rename-tag | Renames closing tags automatically when you edit opening tags. |
| Auto Close Tag | formulahendry.auto-close-tag | Automatically closes HTML/JSX tags. |
| Auto Import | steoates.autoimport | Automatically imports modules. |
| GitLens | eamodio.gitlens | Enhances Git capabilities (history, blame, compare). |
| Code Spell Checker | streetsidesoftware.code-spell-checker | Checks your code for spelling errors. |
Quick Installation via CLI:
code --install-extension xabikos.reactsnippets
code --install-extension esbenp.prettier-vscode
code --install-extension dbaeumer.vscode-eslint
code --install-extension formulahendry.auto-rename-tag
code --install-extension formulahendry.auto-close-tag
code --install-extension steoates.autoimport
code --install-extension eamodio.gitlens
code --install-extension streetsidesoftware.code-spell-checker
3.3. Recommended Extensions
| Extension | ID | Description |
|---|---|---|
| Error Lens | usernamehw.errorlens | Displays errors inline directly on the line of code. |
| Material Icon Theme | pkief.material-icon-theme | Adds stylish icons to your file explorer. |
| One Dark Pro | zhuangtongfa.material-theme | A popular and clean theme. |
| Import Cost | wix.vscode-import-cost | Shows the size of imported packages. |
| Color Highlight | naumovs.color-highlight | Visually highlights color codes. |
| Highlight Matching Tag | vincaslt.highlight-matching-tag | Highlights matching HTML/JSX opening and closing tags. |
3.4. Configuring settings.json
Open your Settings JSON file (Ctrl+Shift+P → “Preferences: Open User Settings (JSON)”):
{
// Editor settings
"editor.fontSize": 14,
"editor.fontFamily": "'JetBrains Mono', 'Fira Code', Consolas, monospace",
"editor.fontLigatures": true,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.minimap.enabled": false,
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": true,
"editor.linkedEditing": true,
// Formatting settings
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit"
},
// File settings
"files.autoSave": "onFocusChange",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
// Prettier specific settings
"prettier.semi": true,
"prettier.singleQuote": true,
"prettier.trailingComma": "es5",
"prettier.printWidth": 100,
// ESLint specific settings
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
// TypeScript specific settings
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.updateImportsOnFileMove.enabled": "always",
// Terminal settings
"terminal.integrated.fontSize": 13,
// Theme and Icon settings
"workbench.colorTheme": "One Dark Pro",
"workbench.iconTheme": "material-icon-theme",
// Emmet specific settings
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"typescript": "typescriptreact"
}
}4. Terminal & Command Line
4.1. Choosing Your Terminal
Windows
| Terminal | Pros | How to Open |
|---|---|---|
| Windows Terminal | Modern, tabbed, customizable | Download from Microsoft Store |
| PowerShell | Built-in, powerful | Search “PowerShell” |
| Git Bash | Unix-like commands | Install with Git |
| Command Prompt (CMD) | Built-in, basic | Search “cmd” |
Recommendation: Install Windows Terminal and use PowerShell or Git Bash within it.
macOS
| Terminal | Pros | How to Open |
|---|---|---|
| Terminal.app | Built-in | Applications → Utilities → Terminal |
| iTerm2 | Feature-rich, highly customizable | Download from iterm2.com |
| Warp | Modern, AI-powered | Download from warp.dev |
Recommendation: Consider installing Oh My Zsh for an enhanced terminal experience:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"Linux
Most Linux distributions come with a default Terminal. If you use Zsh, you can install Oh My Zsh:
# Install Zsh if you don't have it
sudo apt install zsh
# Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
4.2. Basic Commands
| Purpose | Windows (PowerShell/CMD) | macOS/Linux |
|---|---|---|
| View current directory | cd (no arguments) or pwd | pwd |
| List files | dir or ls | ls |
| Navigate directories | cd folder-name | cd folder-name |
| Go up one directory | cd .. | cd .. |
| Create a directory | mkdir folder-name | mkdir folder-name |
| Create an empty file | New-Item filename | touch filename |
| Delete a file | del filename | rm filename |
| Delete a directory | rmdir /s folder-name | rm -rf folder-name |
| View file contents | type filename | cat filename |
| Clear screen | cls or clear | clear |
Useful Shortcuts:
| Shortcut | Function |
|---|---|
Tab | Auto-completes paths/filenames |
↑ / ↓ | Browse command history |
Ctrl+C | Interrupt a running command |
Ctrl+L | Clear the screen (same as clear) |
5. Browser & DevTools
5.1. Installing a Browser
Recommendation: Use Google Chrome or Microsoft Edge (both Chromium-based) for the most powerful DevTools experience.
- Google Chrome: https://www.google.com/chrome
- Microsoft Edge: https://www.microsoft.com/edge
5.2. Installing React Developer Tools
- Open Chrome/Edge.
- Go to the Chrome Web Store:
- Click “Add to Chrome”.
- Confirm by clicking “Add extension”.
After installation:
- You’ll see a React icon on your browser’s toolbar.
- When you open Developer Tools (F12), you’ll find two new tabs: Components and Profiler.

5.3. Installing Ddict (Vietnamese Dictionary)
Ddict is a handy extension for looking up English-Vietnamese translations when reading documentation:
- Visit: Ddict - Chrome Web Store
- Click “Add to Chrome”.
- How to use: Double-click a word or select it to see its meaning.
5.4. Basic Chrome DevTools
Open DevTools by pressing F12 or Ctrl+Shift+I (Windows) / Cmd+Option+I (macOS).
| Tab | Function |
|---|---|
| Elements | Inspect HTML/CSS, edit them live. |
| Console | View logs, execute JavaScript snippets. |
| Sources | Debug your code, set breakpoints. |
| Network | Analyze API requests and resource loading. |
| Application | Inspect LocalStorage, Cookies, Cache. |
| Components (React) | Inspect the React component tree. |
| Profiler (React) | Measure rendering performance. |
