Fix: Ensure react-icons dependency is installed correctly
This commit is contained in:
51
DEPLOYMENT.md
Normal file
51
DEPLOYMENT.md
Normal 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
|
||||||
|
```
|
||||||
|
|
||||||
@@ -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 . .
|
||||||
|
|||||||
Reference in New Issue
Block a user