Skip to content

修复:Windows 启动脚本端口冲突 - #31

Draft
damingishere-coder wants to merge 1 commit into
mainfrom
fix/windows-startup
Draft

修复:Windows 启动脚本端口冲突#31
damingishere-coder wants to merge 1 commit into
mainfrom
fix/windows-startup

Conversation

@damingishere-coder

Copy link
Copy Markdown
Owner

修改内容

  • start_windows.ps1 增加 UTF-8 BOM,确保 Windows PowerShell 5.1 正确解析中文脚本。
  • 调整为先启动前端并等待 6866 端口就绪,再启动后端 8888,避免后端静态服务与 Next.js 抢占 6866。
  • 增加端口等待、重复启动保护、后台命令安全编码和更清晰的失败提示。

根因

原脚本是无 BOM 的 UTF-8 文件,Windows PowerShell 5.1 会按本地代码页读取,中文字符串可能破坏语法。同时原流程先启动后端、固定等待 3 秒后再启动前端,后端检测不到尚未就绪的前端时会尝试绑定 6866,形成端口竞争。

用户影响

双击 start_windows.bat 或运行 start_windows.ps1 时,启动过程可重复执行;脚本会等待实际端口就绪,并避免前后端互相抢占端口。

验证

  • powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\start_windows.ps1:通过,能识别并跳过已运行的 6866/8888 服务。
  • http://127.0.0.1:6866/env-config:HTTP 200。
  • http://127.0.0.1:8888/api/health:HTTP 200(浏览器自动化模块状态由运行时页面进程决定)。
  • git diff --check:通过。
  • 敏感信息差异扫描:未发现密钥、Token、Cookie 或密码值。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant