Setup und Starten » History » Version 3
Daniel Noah Hildebrandt, 11/05/2026 01:05 PM
Text überarbeitet: Gedankenstriche durch ganze Sätze ersetzt
| 1 | 1 | Daniel Noah Hildebrandt | h1. Setup & Starten |
|---|---|---|---|
| 2 | |||
| 3 | {{toc}} |
||
| 4 | |||
| 5 | h2. Voraussetzungen |
||
| 6 | |||
| 7 | 3 | Daniel Noah Hildebrandt | * "Node.js":https://nodejs.org (LTS-Version). Phaser und alle anderen Pakete installiert npm automatisch, ein separater Download ist *nicht* nötig. |
| 8 | 1 | Daniel Noah Hildebrandt | * "Git":https://git-scm.com |
| 9 | * Editor: "Visual Studio Code":https://code.visualstudio.com (empfohlen, optional mit der Erweiterung _ESLint_) |
||
| 10 | |||
| 11 | Nach der Installation von Node.js in einem *neuen* Terminal prüfen: |
||
| 12 | |||
| 13 | <pre> |
||
| 14 | node -v |
||
| 15 | npm -v |
||
| 16 | </pre> |
||
| 17 | |||
| 18 | h2. Projekt einrichten |
||
| 19 | |||
| 20 | <pre> |
||
| 21 | git clone https://gitlab.hof-university.de/Vi/gamedesign_ws2627.git |
||
| 22 | cd gamedesign_ws2627 |
||
| 23 | npm install |
||
| 24 | </pre> |
||
| 25 | |||
| 26 | 3 | Daniel Noah Hildebrandt | @npm install@ ist nur einmal nötig und erst wieder, wenn jemand neue Pakete hinzufügt. Der Ordner @node_modules@ wird *nie* committet (steht in der @.gitignore@). |
| 27 | 1 | Daniel Noah Hildebrandt | |
| 28 | h2. Spiel starten |
||
| 29 | |||
| 30 | <pre> |
||
| 31 | npm run dev-nolog |
||
| 32 | </pre> |
||
| 33 | |||
| 34 | Danach im Browser *http://localhost:8080* öffnen. Änderungen am Code werden beim Speichern automatisch neu geladen. Server beenden mit @Strg + C@. |
||
| 35 | |||
| 36 | 2 | Daniel Noah Hildebrandt | @npm run dev@ funktioniert genauso. Seit dem Umbau zum Prototyp „Küstenfahrt“ sendet das Projekt keine Nutzungsdaten mehr an Phaser (die Datei @log.js@ wurde entfernt), beide Befehle sind also gleichwertig. |
| 37 | 1 | Daniel Noah Hildebrandt | |
| 38 | h2. Fertigen Build erstellen |
||
| 39 | |||
| 40 | <pre> |
||
| 41 | npm run build-nolog |
||
| 42 | </pre> |
||
| 43 | |||
| 44 | 2 | Daniel Noah Hildebrandt | Vor dem Build läuft automatisch die TypeScript-Prüfung. Das fertige Spiel liegt anschließend im Ordner @dist/@. |
| 45 | |||
| 46 | Weitere Befehle: @npm run typecheck@ (TypeScript prüfen) und @npm run lint@ (Code-Stil prüfen). |
||
| 47 | 1 | Daniel Noah Hildebrandt | |
| 48 | h2. Häufige Probleme |
||
| 49 | |||
| 50 | |_. Problem |_. Lösung | |
||
| 51 | |PowerShell: _„Die Ausführung von Skripts ist auf diesem System deaktiviert“_ |Einmalig @Set-ExecutionPolicy -Scope CurrentUser RemoteSigned@ ausführen und mit @J@ bestätigen. Alternativ @npm.cmd@ statt @npm@ verwenden oder in VS Code das Terminal auf „Command Prompt“ umstellen. | |
||
| 52 | |_„npm wird nicht erkannt“_ |Terminal bzw. VS Code nach der Node.js-Installation neu öffnen. | |
||
| 53 | |Warnung @install-scripts … esbuild@ |Meist harmlos. Falls ein esbuild-Fehler auftritt: @npm install-scripts approve esbuild@ und danach @npm install@. | |
||
| 54 | 3 | Daniel Noah Hildebrandt | |Warnung @1 moderate severity vulnerability@ |Ignorieren. *Nicht* @npm audit fix --force@ ausführen, denn das kann das Projekt kaputt machen. | |
| 55 | |Port 8080 belegt |Vite weicht automatisch auf einen anderen Port aus. Welcher es ist, steht im Terminal. | |
||
| 56 | 1 | Daniel Noah Hildebrandt | |
| 57 | h2. Git-Grundlagen |
||
| 58 | |||
| 59 | * Vor jeder Arbeit den aktuellen Stand holen: @git pull@ |
||
| 60 | * Neue Features in einem eigenen Branch entwickeln: @git switch -c feature/name@ |
||
| 61 | 3 | Daniel Noah Hildebrandt | * @git fetch@ ist ungefährlich. Es lädt nur Infos vom Server und ändert keine Dateien. |