diff --git a/start_server.sh b/start_server.sh index 1df72106..90bc9a30 100755 --- a/start_server.sh +++ b/start_server.sh @@ -128,9 +128,9 @@ if [[ ! -f "../$DATA_DIR/inventory.db" ]]; then python3 -c "from db_manager import init_db; init_db()" || true fi -# Start uvicorn in background +# Start uvicorn in background (with proper working directory) log_info " Starting uvicorn server..." -python3 -m uvicorn main:app --host 0.0.0.0 --port "$BACKEND_PORT" --log-level "${LOG_LEVEL,,}" >> "$BACKEND_LOG" 2>&1 & +(cd "$(pwd)" && python3 -m uvicorn main:app --host 0.0.0.0 --port "$BACKEND_PORT" --log-level "${LOG_LEVEL,,}" >> "$BACKEND_LOG" 2>&1) & BACKEND_PID=$! log_success " ✓ Backend started (PID: $BACKEND_PID, Port: $BACKEND_PORT)" @@ -163,9 +163,10 @@ if [[ ! -d ".next" ]]; then npm run build || log_error "Failed to build frontend" fi -# Start Next.js in production mode +# Start Next.js in production mode (with proper working directory) log_info " Starting Next.js server..." -PORT="$FRONTEND_PORT" node .next/standalone/server.js >> "$FRONTEND_LOG" 2>&1 & +FRONTEND_DIR="$(pwd)" +(cd "$FRONTEND_DIR" && PORT="$FRONTEND_PORT" node .next/standalone/server.js >> "$FRONTEND_LOG" 2>&1) & FRONTEND_PID=$! log_success " ✓ Frontend started (PID: $FRONTEND_PID, Port: $FRONTEND_PORT)"