Fix: Ensure react-icons dependency is installed correctly

This commit is contained in:
2025-12-05 01:11:19 +01:00
parent 8fbe1113dd
commit 45462aa74b
2 changed files with 54 additions and 3 deletions

51
DEPLOYMENT.md Normal file
View File

@@ -0,0 +1,51 @@
# Deployment-Anleitung
## Problem: react-icons nicht gefunden
Wenn auf dem Production-Server der Fehler `Module not found: Can't resolve 'react-icons/fa'` auftritt, liegt das daran, dass die Dependencies nicht neu installiert wurden.
## Lösung
Nach `git pull` auf dem Server müssen die Docker-Container neu gebaut werden:
```bash
# Container stoppen
docker compose down
# Container neu bauen (ohne Cache, um sicherzustellen, dass alle Dependencies neu installiert werden)
docker compose build --no-cache
# Container starten
docker compose up -d
# Logs prüfen
docker compose logs -f
```
## Alternative: Volume löschen
Falls das Problem weiterhin besteht, kann das `node_modules` Volume gelöscht werden:
```bash
docker compose down -v
docker compose build --no-cache
docker compose up -d
```
## Wichtige Dateien für den Build
Folgende Dateien müssen im Repository sein:
- `package.json` (enthält `react-icons: ^4.12.0`)
- `Dockerfile.dev` (für Development)
- `Dockerfile` (für Production)
- `docker-compose.yml`
- Alle Source-Dateien, die `react-icons` verwenden
## Verifizierung
Nach dem Build sollte `react-icons` in `node_modules` vorhanden sein:
```bash
docker compose exec web ls -la node_modules | grep react-icons
```

View File

@@ -2,11 +2,11 @@ FROM node:18-alpine
WORKDIR /app WORKDIR /app
# Copy package files # Copy package files first for better caching
COPY package.json package-lock.json* ./ COPY package.json package-lock.json* ./
# Install dependencies # Install dependencies (no cache to ensure fresh install)
RUN npm install RUN npm install --no-cache
# Copy app files # Copy app files
COPY . . COPY . .