5.0 KiB
Les 2: Voorbereiding (Verplicht!)
⚠️ BELANGRIJK: Voltooi deze stappen VOOR Les 2 begint. Zonder deze setup kun je niet meedoen!
Geschatte tijd: 20-30 minuten
Checklist
Aan het einde van deze voorbereiding heb je:
- Node.js geïnstalleerd via NVM
- Git geïnstalleerd
- SSH key gegenereerd en toegevoegd aan GitHub
- Terminal basics begrepen
1. Node.js installeren via NVM
Waarom NVM? NVM (Node Version Manager) laat je makkelijk wisselen tussen Node versies. Veel projecten vereisen specifieke versies.
Mac / Linux
Open Terminal en voer uit:
# 1. Installeer NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# 2. Sluit terminal en open opnieuw (of run dit):
source ~/.zshrc # voor zsh (standaard op Mac)
# OF
source ~/.bashrc # voor bash
# 3. Installeer Node 20 (LTS)
nvm install 20
# 4. Gebruik Node 20 als standaard
nvm use 20
nvm alias default 20
# 5. Controleer installatie
node -v # Moet v20.x.x tonen
npm -v # Moet 10.x.x tonen
Windows
Optie A: NVM voor Windows (aanbevolen)
- Download installer: https://github.com/coreybutler/nvm-windows/releases
- Download
nvm-setup.exe - Installeer (volg wizard)
- Open nieuwe PowerShell of Command Prompt
- Voer uit:
nvm install 20
nvm use 20
node -v # Moet v20.x.x tonen
Optie B: Direct Node.js installeren
- Ga naar https://nodejs.org
- Download LTS versie (20.x)
- Installeer (volg wizard)
- Herstart terminal
- Controleer:
node -v
2. Git installeren
Mac
Git is vaak al geïnstalleerd. Check:
git --version
Als niet geïnstalleerd:
# Via Homebrew (aanbevolen)
brew install git
# Of download van https://git-scm.com/download/mac
Windows
- Download van https://git-scm.com/download/windows
- Installeer (gebruik standaard opties)
- Belangrijk: Kies "Git Bash" als terminal optie
- Herstart terminal
- Controleer:
git --version
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install git
git --version
3. SSH Key voor GitHub
Waarom SSH? Met SSH hoef je niet steeds je wachtwoord in te voeren bij git push/pull.
Stap 1: Genereer SSH key
Mac / Linux / Git Bash (Windows):
# Genereer key (vervang met je eigen email!)
ssh-keygen -t ed25519 -C "jouw-email@example.com"
# Druk Enter voor standaard locatie
# Kies wachtwoord of laat leeg (Enter)
Stap 2: Kopieer je public key
Mac:
cat ~/.ssh/id_ed25519.pub | pbcopy
Linux:
cat ~/.ssh/id_ed25519.pub
# Selecteer en kopieer handmatig
Windows (Git Bash):
cat ~/.ssh/id_ed25519.pub | clip
Stap 3: Voeg toe aan GitHub
- Ga naar https://github.com/settings/keys
- Klik "New SSH key"
- Titel: "Mijn Laptop" (of iets herkenbaars)
- Plak je key
- Klik "Add SSH key"
Stap 4: Test de verbinding
ssh -T git@github.com
Je ziet: Hi username! You've successfully authenticated...
⚠️ Eerste keer: Je krijgt een vraag over fingerprint. Type yes.
4. Terminal Basics
Je hebt een terminal nodig om met OpenCode te werken. Hier de basics:
Wat is een terminal?
- Mac: Terminal app (in Applications → Utilities)
- Windows: PowerShell, Command Prompt, of Git Bash (aanbevolen)
- Linux: Terminal
Basis commando's
| Commando | Wat het doet | Voorbeeld |
|---|---|---|
pwd |
Toon huidige map | pwd → /Users/tim/projects |
ls |
Toon bestanden in map | ls → toont bestanden |
cd |
Ga naar map | cd projects |
cd .. |
Ga map omhoog | cd .. |
mkdir |
Maak nieuwe map | mkdir mijn-project |
Oefening
Open je terminal en probeer:
# 1. Waar ben ik?
pwd
# 2. Wat staat hier?
ls
# 3. Ga naar Documents (of andere map)
cd Documents
# 4. Waar ben ik nu?
pwd
# 5. Ga terug
cd ..
5. Controleer alles
Voer deze commando's uit en controleer de output:
# Node.js versie (moet 20.x.x zijn)
node -v
# npm versie (moet 10.x.x zijn)
npm -v
# Git versie
git --version
# SSH verbinding met GitHub
ssh -T git@github.com
Alles werkt? ✅ Je bent klaar voor Les 2!
Troubleshooting
"command not found: nvm"
- Sluit terminal en open opnieuw
- Mac: voeg toe aan
~/.zshrc:export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
"Permission denied" bij npm install
- Gebruik
sudo npm install -g ...(Mac/Linux) - Of fix npm permissies: https://docs.npmjs.com/resolving-eacces-permissions-errors
"Permission denied (publickey)" bij GitHub
- Je SSH key is niet goed toegevoegd
- Controleer:
ls ~/.ssh/- je moetid_ed25519enid_ed25519.pubzien - Voeg opnieuw toe aan GitHub
Windows: Git Bash vs PowerShell
- Git Bash: Unix-achtige commando's (
ls,cat, etc.) - PowerShell: Windows commando's
- Tip: Gebruik Git Bash voor consistentie met Mac/Linux
Hulp nodig?
- Stuur bericht via Teams
- Kom 15 minuten eerder naar Les 2 voor hulp
Tot Les 2! 🚀