Improve Windows startup and diagnostics
- Windows-Start.bat: Always open dashboard instead of Config.html The dashboard can guide first-time setup, avoiding file:// protocol issues - Windows-Diagnose.bat: Add Chinese output for better user experience Error counting and friendly suggestions included 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -21,65 +21,70 @@ echo ======================================== >> "%LOG_FILE%"
|
||||
echo. >> "%LOG_FILE%"
|
||||
|
||||
REM 1. Check Node.js
|
||||
echo [1/6] Checking Node.js runtime...
|
||||
echo [1/6] 检查 Node.js 运行环境...
|
||||
set "NODE_BIN=%UCLAW_DIR%app\runtime\node-win-x64\node.exe"
|
||||
set "ERROR_COUNT=0"
|
||||
if exist "%NODE_BIN%" (
|
||||
echo [OK] Node.js found >> "%LOG_FILE%"
|
||||
for /f "tokens=*" %%v in ('"%NODE_BIN%" --version 2^>^&1') do echo Version: %%v >> "%LOG_FILE%"
|
||||
echo ✓ Node.js: Found
|
||||
echo ✓ Node.js 运行环境: 正常
|
||||
) else (
|
||||
echo [ERROR] Node.js not found >> "%LOG_FILE%"
|
||||
echo [X] Node.js: NOT FOUND
|
||||
echo ✗ Node.js 运行环境: 缺失
|
||||
echo Path: %NODE_BIN% >> "%LOG_FILE%"
|
||||
set /a ERROR_COUNT+=1
|
||||
)
|
||||
|
||||
REM 2. Check core-win directory
|
||||
echo [2/6] Checking core-win directory...
|
||||
echo [2/6] 检查 Windows 依赖目录...
|
||||
set "CORE_DIR=%UCLAW_DIR%app\core-win"
|
||||
if exist "%CORE_DIR%" (
|
||||
echo [OK] core-win directory exists >> "%LOG_FILE%"
|
||||
echo ✓ core-win: Found
|
||||
echo ✓ Windows 依赖目录: 正常
|
||||
) else (
|
||||
echo [ERROR] core-win directory not found >> "%LOG_FILE%"
|
||||
echo [X] core-win: NOT FOUND
|
||||
echo ✗ Windows 依赖目录: 缺失
|
||||
set /a ERROR_COUNT+=1
|
||||
)
|
||||
|
||||
REM 3. Check node_modules
|
||||
echo [3/6] Checking dependencies...
|
||||
echo [3/6] 检查 npm 依赖包...
|
||||
if exist "%CORE_DIR%\node_modules" (
|
||||
echo [OK] node_modules exists >> "%LOG_FILE%"
|
||||
echo ✓ Dependencies: Found
|
||||
echo ✓ npm 依赖包: 已安装
|
||||
) else (
|
||||
echo [ERROR] node_modules not found >> "%LOG_FILE%"
|
||||
echo [X] Dependencies: NOT FOUND
|
||||
echo ✗ npm 依赖包: 未安装
|
||||
set /a ERROR_COUNT+=1
|
||||
)
|
||||
|
||||
REM 4. Check OpenClaw
|
||||
echo [4/6] Checking OpenClaw...
|
||||
echo [4/6] 检查 OpenClaw 核心文件...
|
||||
set "OPENCLAW_MJS=%CORE_DIR%\node_modules\openclaw\openclaw.mjs"
|
||||
if exist "%OPENCLAW_MJS%" (
|
||||
echo [OK] openclaw.mjs found >> "%LOG_FILE%"
|
||||
echo ✓ OpenClaw: Found
|
||||
echo ✓ OpenClaw 核心: 正常
|
||||
) else (
|
||||
echo [ERROR] openclaw.mjs not found >> "%LOG_FILE%"
|
||||
echo [X] OpenClaw: NOT FOUND
|
||||
echo ✗ OpenClaw 核心: 缺失
|
||||
echo Path: %OPENCLAW_MJS% >> "%LOG_FILE%"
|
||||
set /a ERROR_COUNT+=1
|
||||
)
|
||||
|
||||
REM 5. Check port availability
|
||||
echo [5/6] Checking port 18789...
|
||||
echo [5/6] 检查端口占用...
|
||||
netstat -an | findstr ":18789 " | findstr "LISTENING" >nul 2>&1
|
||||
if %errorlevel%==0 (
|
||||
echo [WARNING] Port 18789 is in use >> "%LOG_FILE%"
|
||||
echo ⚠ Port 18789: IN USE
|
||||
echo ⚠ 端口 18789: 已被占用
|
||||
netstat -ano | findstr ":18789 " >> "%LOG_FILE%"
|
||||
) else (
|
||||
echo [OK] Port 18789 is available >> "%LOG_FILE%"
|
||||
echo ✓ Port 18789: Available
|
||||
echo ✓ 端口 18789: 可用
|
||||
)
|
||||
|
||||
REM 6. Test OpenClaw startup
|
||||
echo [6/6] Testing OpenClaw startup...
|
||||
echo [6/6] 测试 OpenClaw 启动...
|
||||
echo. >> "%LOG_FILE%"
|
||||
echo Testing OpenClaw startup: >> "%LOG_FILE%"
|
||||
echo ---------------------------------------- >> "%LOG_FILE%"
|
||||
@@ -92,13 +97,14 @@ if exist "%NODE_BIN%" if exist "%OPENCLAW_MJS%" (
|
||||
cd /d "%CORE_DIR%"
|
||||
"%NODE_BIN%" "%OPENCLAW_MJS%" --version >> "%LOG_FILE%" 2>&1
|
||||
if %errorlevel%==0 (
|
||||
echo ✓ OpenClaw: Can run
|
||||
echo ✓ OpenClaw 启动测试: 通过
|
||||
) else (
|
||||
echo [X] OpenClaw: Failed to run
|
||||
echo ✗ OpenClaw 启动测试: 失败
|
||||
echo [ERROR] OpenClaw failed to start >> "%LOG_FILE%"
|
||||
set /a ERROR_COUNT+=1
|
||||
)
|
||||
) else (
|
||||
echo [X] Cannot test - files missing
|
||||
echo ⚠ OpenClaw 启动测试: 跳过(文件缺失)
|
||||
echo [SKIP] Cannot test - required files missing >> "%LOG_FILE%"
|
||||
)
|
||||
|
||||
@@ -106,16 +112,31 @@ echo.
|
||||
echo. >> "%LOG_FILE%"
|
||||
echo ======================================== >> "%LOG_FILE%"
|
||||
echo Diagnostic complete. >> "%LOG_FILE%"
|
||||
echo Error count: %ERROR_COUNT% >> "%LOG_FILE%"
|
||||
|
||||
echo ========================================
|
||||
echo Diagnostic Complete
|
||||
echo 诊断完成
|
||||
echo ========================================
|
||||
echo.
|
||||
echo Log saved to: diagnostic-log.txt
|
||||
|
||||
if %ERROR_COUNT%==0 (
|
||||
echo ✅ 检查结果: 全部正常!
|
||||
echo 所有必需的组件都已就绪,可以正常使用。
|
||||
echo.
|
||||
echo 💡 下一步:
|
||||
echo - 双击 Windows-Start.bat 启动服务
|
||||
echo - 或查看 Welcome.html 了解使用说明
|
||||
) else (
|
||||
echo ❌ 检查结果: 发现 %ERROR_COUNT% 个问题
|
||||
echo.
|
||||
echo 💡 解决方案:
|
||||
echo 1. 查看 diagnostic-log.txt 了解详细错误
|
||||
echo 2. 尝试重新运行 Windows-Start.bat
|
||||
echo (会自动安装缺失的依赖)
|
||||
echo 3. 如问题仍然存在,请查看 Welcome.html
|
||||
echo 或访问 github.com/dongsheng123132/u-claw
|
||||
)
|
||||
echo.
|
||||
echo Next steps:
|
||||
echo 1. Check diagnostic-log.txt for details
|
||||
echo 2. If errors found, try running Windows-Start.bat
|
||||
echo to auto-install missing dependencies
|
||||
echo 📄 诊断日志已保存: diagnostic-log.txt
|
||||
echo.
|
||||
pause
|
||||
|
||||
@@ -84,19 +84,11 @@ echo.
|
||||
|
||||
cd /d "%CORE_DIR%"
|
||||
|
||||
REM Check if model is configured - open Config.html for first time, dashboard for returning users
|
||||
set "HAS_MODEL=no"
|
||||
if exist "%STATE_DIR%\openclaw.json" (
|
||||
findstr /c:"agent" "%STATE_DIR%\openclaw.json" >nul 2>&1 && set "HAS_MODEL=yes"
|
||||
)
|
||||
|
||||
if "%HAS_MODEL%"=="yes" (
|
||||
echo Opening dashboard...
|
||||
start "" http://127.0.0.1:%PORT%/#token=uclaw
|
||||
) else (
|
||||
echo First time - opening Config page...
|
||||
start "" "%UCLAW_DIR%Config.html?port=%PORT%"
|
||||
)
|
||||
REM Always open dashboard - it will guide first-time setup
|
||||
echo 正在打开控制台...
|
||||
echo Opening dashboard at http://127.0.0.1:%PORT%
|
||||
timeout /t 2 /nobreak >nul
|
||||
start "" http://127.0.0.1:%PORT%/#token=uclaw
|
||||
|
||||
set "OPENCLAW_MJS=%CORE_DIR%\node_modules\openclaw\openclaw.mjs"
|
||||
"%NODE_BIN%" "%OPENCLAW_MJS%" gateway run --allow-unconfigured --force --port %PORT%
|
||||
|
||||
Reference in New Issue
Block a user