fix: start scripts now validate prerequisites and stop on failure

- Check for Python and Node.js before starting
- Stop with clear error message if pip install fails
- Recommend Python 3.10-3.12 (3.13+ has compatibility issues)
- Show version info at startup for easier debugging
- Updated README with Python version guidance
This commit is contained in:
anoracleofra-code
2026-03-09 09:25:57 -06:00
parent 14dc1a714d
commit 28f92f1cb9
3 changed files with 99 additions and 22 deletions
+61 -7
View File
@@ -5,28 +5,82 @@ echo ===================================================
echo S H A D O W B R O K E R -- STARTUP
echo ===================================================
echo.
echo Installing backend dependencies if needed...
:: Check for Python
where python >nul 2>&1
if %errorlevel% neq 0 (
echo [!] ERROR: Python is not installed or not in PATH.
echo [!] Install Python 3.10-3.12 from https://python.org
echo [!] IMPORTANT: Check "Add to PATH" during install.
echo.
pause
exit /b 1
)
:: Check Python version
for /f "tokens=2 delims= " %%v in ('python --version 2^>^&1') do set PYVER=%%v
echo [*] Found Python %PYVER%
:: Check for Node.js
where npm >nul 2>&1
if %errorlevel% neq 0 (
echo [!] ERROR: Node.js/npm is not installed or not in PATH.
echo [!] Install Node.js 18+ from https://nodejs.org
echo.
pause
exit /b 1
)
for /f "tokens=1 delims= " %%v in ('node --version 2^>^&1') do echo [*] Found Node.js %%v
echo.
echo [*] Setting up backend...
cd backend
if not exist "venv\" (
echo Creating Python virtual environment...
echo [*] Creating Python virtual environment...
python -m venv venv
if %errorlevel% neq 0 (
echo [!] ERROR: Failed to create virtual environment.
pause
exit /b 1
)
)
call venv\Scripts\activate.bat
echo [*] Installing Python dependencies (this may take a minute)...
pip install -r requirements.txt
if %errorlevel% neq 0 (
echo.
echo [!] ERROR: pip install failed. See errors above.
echo [!] If you see Rust/cargo errors, your Python version may be too new.
echo [!] Recommended: Python 3.10, 3.11, or 3.12.
echo.
pause
exit /b 1
)
echo [*] Backend dependencies OK.
cd ..
echo.
echo Installing frontend dependencies if needed...
echo [*] Setting up frontend...
cd frontend
if not exist "node_modules\" (
echo Running npm install...
echo [*] Installing frontend dependencies...
call npm install
if %errorlevel% neq 0 (
echo [!] ERROR: npm install failed. See errors above.
pause
exit /b 1
)
)
echo [*] Frontend dependencies OK.
echo.
echo Starting both services...
echo (Press Ctrl+C to stop the dashboard)
echo ===================================================
echo Starting services...
echo Dashboard: http://localhost:3000
echo Keep this window open! Initial load takes ~10s.
echo ===================================================
echo (Press Ctrl+C to stop)
echo.
:: Start the dev server which runs both NEXT and API via concurrently
call npm run dev