Fix frontend startup by auto-installing npm dependencies

The start script was running `npm run dev` without checking if
node_modules existed, causing "vite: command not found" errors
for new users who hadn't manually run npm install.

Now checks for node_modules and runs npm install automatically
if dependencies are missing.
This commit is contained in:
Illya 2025-12-08 16:40:53 -05:00
parent 3a5d7dee81
commit a77c439015

View file

@ -194,6 +194,21 @@ if check_port 5173; then
fi
cd "$PROJECT_DIR/frontend"
# Check if node_modules exists, install dependencies if not
if [ ! -d "node_modules" ]; then
echo " Installing frontend dependencies..."
npm install > "$PROJECT_DIR/logs/frontend.log" 2>&1
if [ $? -eq 0 ]; then
echo -e " ${GREEN}✓ Frontend dependencies installed${NC}"
else
echo -e " ${RED}❌ Failed to install frontend dependencies${NC}"
echo " Check logs with: tail -f logs/frontend.log"
cd "$PROJECT_DIR"
exit 1
fi
fi
nohup npm run dev -- --host 0.0.0.0 > "$PROJECT_DIR/logs/frontend.log" 2>&1 &
FRONTEND_PID=$!
echo " Frontend PID: $FRONTEND_PID (logging to logs/frontend.log)"