Visual Studio 代码 - 无法启动浏览器:"Unable to find an installation of the browser on your system."

Visual Studio Code - Unable to launch Browser: "Unable to find an installation of the browser on your system."

最近在 VS 代码中 运行 脚本(我在 python、javascript、html... 中的任何脚本)时出现了一个问题。弹出窗口说:Visual Studio Code - Unable to launch Browser: "Unable to find an installation of the browser on your system.Try installing it, or providing an absolute path to the browser in the "runtimeExecutable" in your launch.json.

我的浏览器是edge。当我打开 launch.json 时,我看到它似乎正在尝试使用 chrome 而不是我没有在我的计算机上下载的

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}"
        }
    ]
}

我可以更改配置以匹配我 运行 在计算机上使用的浏览器吗?或者我还能做些什么来解决这个问题?

谢谢!

是的,您需要更改配置以启动 Edge 进行调试。可以参考this doc。您需要将 type 更改为 pwa-msedge:

"type": "pwa-msedge",