Refactor deploy-to-opt.sh and fix-npm-cache.sh to set HOME environment variable during npm cache configuration, ensuring correct usage of custom cache directory and improving .npmrc management.

This commit is contained in:
Torsten Schulz (local)
2025-12-04 17:03:56 +01:00
parent 34df89c1ac
commit 9aef5ef901
2 changed files with 30 additions and 6 deletions

View File

@@ -79,7 +79,7 @@ chown -R $USER:$GROUP "$NPM_CACHE_DIR"
# Installiere Dependencies
echo ""
echo "Installiere Dependencies..."
sudo -u $USER bash -c "cd '$TARGET_DIR' && npm config set cache '$NPM_CACHE_DIR' && npm run install:all"
sudo -u $USER bash -c "cd '$TARGET_DIR' && HOME='$TARGET_DIR' npm config set cache '$NPM_CACHE_DIR' && HOME='$TARGET_DIR' npm run install:all"
if [ $? -ne 0 ]; then
echo "FEHLER: Installation der Dependencies fehlgeschlagen!"
@@ -91,7 +91,7 @@ echo "✓ Dependencies installiert"
# Baue Client
echo ""
echo "Baue Client für Production..."
sudo -u $USER bash -c "cd '$TARGET_DIR' && npm config set cache '$NPM_CACHE_DIR' && cd client && npm config set cache '$NPM_CACHE_DIR' && cd .. && npm run build"
sudo -u $USER bash -c "cd '$TARGET_DIR' && HOME='$TARGET_DIR' npm config set cache '$NPM_CACHE_DIR' && cd client && HOME='$TARGET_DIR' npm config set cache '$NPM_CACHE_DIR' && cd .. && HOME='$TARGET_DIR' npm run build"
if [ $? -ne 0 ]; then
echo "FEHLER: Build fehlgeschlagen!"