You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在VS Code中通过附加到Edge浏览器进行调试?已完成配置但出现错误

Troubleshooting Edge JavaScript Debugger Issues in VS Code

Hey there! Let’s work through fixing the error you’re hitting with your Edge debugger setup in VS Code. First, let’s recap what you’ve already configured correctly:

Your Current Setup

  • You’ve installed the Edge JavaScript Debugger extension in VS Code
  • Your launch.json includes this attach configuration:
"configurations": [
    {
        "name": "Attach to Edge",
        "port": 9222,
        "request": "attach",
        "type": "pwa-msedge",
        "webRoot": "${workspaceFolder}"
    }
]
  • You launched Edge with remote debugging enabled using this command:
start msedge.exe --remote-debugging-port=9222

Common Fixes for Attach Errors

Since you didn’t share the exact error message, here are the most frequent issues and their quick fixes:

1. Check for Port Conflicts

Port 9222 might be used by another app. Open Command Prompt and run this to check:

netstat -ano | findstr :9222

If you see a process ID (PID), open Task Manager, find that process, end it, then restart Edge with the remote debugging flag.

2. Use a Dedicated Debug Profile

Edge might be launching with your main profile, which can cause conflicts. Try starting Edge with a fresh, debug-only profile:

start msedge.exe --remote-debugging-port=9222 --user-data-dir="C:\Temp\EdgeDebugProfile"

This avoids any settings or extensions in your regular profile interfering with debugging.

3. Verify the webRoot Path

The ${workspaceFolder} variable points to the root folder you have open in VS Code. If your web files (HTML/JS) are in a subfolder like src, update webRoot to match:

"webRoot": "${workspaceFolder}/src"

Double-check that the path matches where your actual code lives.

4. Kill Edge Background Processes

Even if you closed Edge, it might still run in the system tray. Right-click the Edge icon there and select "Exit" before launching it with the debug command again.

5. Restart VS Code and the Debugger

Sometimes the extension gets stuck. Close VS Code entirely, restart it, launch Edge with the debug flag, and try attaching the debugger again.

If none of these work, sharing the exact error text from the VS Code Debug Console or Problems tab will help us pinpoint the issue even better!

内容的提问来源于stack exchange,提问作者Harkirat singh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 20:32:38