minishouyin/启动收银台.bat
2025-11-12 11:35:57 +08:00

70 lines
1.7 KiB
Batchfile

@echo off
chcp 65001 >nul
cd /d %~dp0
echo ========================================
echo Mini Cashier System
echo ========================================
echo.
echo Starting system...
REM Set Electron environment variables to avoid cache errors
set ELECTRON_DISABLE_GPU=1
set ELECTRON_NO_SANDBOX=1
set ELECTRON_ENABLE_LOGGING=1
set ELECTRON_FORCE_WINDOW_MENU_BAR=1
set ELECTRON_DISABLE_SANDBOX=1
set ELECTRON_DISABLE_WEB_SECURITY=0
REM Set additional environment variables for better compatibility
set NODE_ENV=production
set ELECTRON_RUN_AS_NODE=
REM Clean up possible port conflicts
echo Checking for port conflicts...
for /f "tokens=5" %%a in ('netstat -aon ^| findstr ":3000 :3001"') do (
echo Killing process on port: %%a
taskkill /f /pid %%a 2>nul
)
echo.
echo Starting server...
echo System will run on port 3000 or 3001
echo.
REM Check if build exists
if not exist "build\index.html" (
echo Warning: Build files not found. Building project...
npm run build
if errorlevel 1 (
echo Error: Build failed. Please check your environment.
pause
exit /b 1
)
)
REM Start the application
npm start
if errorlevel 1 (
echo.
echo ========================================
echo Error: Failed to start the application
echo ========================================
echo Possible solutions:
echo 1. Run "npm run build" to rebuild the project
echo 2. Check if port 3000 and 3001 are available
echo 3. Check the console logs for detailed error information
echo.
pause
exit /b 1
)
echo.
echo ========================================
echo System startup completed
echo ========================================
echo Press any key to exit...
echo ========================================
pause