T01: Environment Setup

Every craftsman sets up the workbench before the first cut. To build for the web you need four tools: an editor to write code, a runtime to execute JavaScript outside the browser, version control to track every change, and a browser to view the result. Do it once, forget it forever.

What You Are Installing

Install VS Code

Go to code.visualstudio.com and download the installer for your operating system. Accept the defaults. When prompted during install, check Add to PATH and Register as editor for supported file types.

After install, open VS Code and look around:

Install Node.js

Go to nodejs.org and download the LTS (Long-Term Support) version. Accept defaults. LTS is the boring-reliable choice; avoid the "Current" channel for learning.

On Mac, if you already use Homebrew, brew install node works. On Linux, your distro's package manager is fine, but node's version may be old; consider nvm for flexibility later.

Install Git

Git is the version-control system every professional codebase uses and the one GitHub speaks. You will use it every day from T19 onwards.

After installing, tell git who you are. This runs once per machine and labels every commit you ever make.

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Verify Everything Works

Open VS Code, then open the integrated terminal (Ctrl + `). Run these four commands. Each should print a version number.

node -v      # v20.x.x or newer
npm -v       # 10.x.x or newer
code -v      # VS Code version
git --version  # any version works

If any command prints "command not found", close all terminal windows, open a new one, and try again. The installer updated your PATH, and PATH only applies to new terminals. Still broken? Restart the computer.

Your First File

Let's prove the whole chain works end to end.

  1. In VS Code, open a folder: File > Open Folder. Pick or create a folder called learning.
  2. Create a new file named hello.html.
  3. Paste this in and save with Cmd/Ctrl + S:
<!DOCTYPE html>
<html>
<head><title>Hello</title></head>
<body>
    <h1>It works!</h1>
    <script>
        console.log("Also in the browser console.");
    </script>
</body>
</html>

Open the file in your browser (double-click it, or drag it onto the browser). Open devtools with F12 and switch to the Console tab. You should see the log line.

flowchart LR VSC[VS Code
write code] Disk[hello.html on disk] Browser[Browser
renders + runs JS] DevTools[DevTools F12
inspect + debug] Terminal[VS Code terminal
node, npm, git] VSC -->|Save| Disk Disk -->|Open| Browser Browser --> DevTools VSC -.->|Ctrl+backtick| Terminal Terminal -.->|node, npm| Disk

Extensions Worth Installing

Open the Extensions panel in VS Code (square icon on the left bar). Install these four:

To enable format-on-save, open settings (Cmd/Ctrl + ,), search "format on save", and check the box.

Key Takeaways

  • Three tools: VS Code (editor), Node.js LTS (runtime), a modern browser with devtools
  • Verify with node -v, npm -v, git --version, code -v. All four should print versions
  • Learn VS Code shortcuts early: Cmd/Ctrl+P (quick open), Cmd/Ctrl+Shift+P (command palette), Ctrl+backtick (terminal)
  • Install Prettier, ESLint, Live Server, GitLens. Enable format-on-save
  • If a command is "not found", open a fresh terminal. If still broken, restart. PATH updates need a new shell