拨开荷叶行,寻梦已然成。仙女莲花里,翩翩白鹭情。
IMG-LOGO
主页 文章列表 VSCode无法连接到谷歌浏览器进行html除错

VSCode无法连接到谷歌浏览器进行html除错

白鹭 - 2022-01-26 2002 0 0

我在通过 html vscode 除错连接到 chrome 时遇到问题。每次我进入运行选单并单击“开始除错”“不除错运行”时,谷歌浏览器都会打开并显示新标签,而不是我正在除错的档案。回到vscode,发现呼叫堆栈是空的。我也尝试过使用launch.json档案。我以前没有遇到过这个问题。我能够在没有 chrome 除错器扩展(现已弃用)的情况下使用 chrome 除错 html。我不知道为什么我现在遇到这些问题。请问有人可以帮我解决这个问题吗?谢谢。

注意:我最近卸载并安装了最新版本的 chrome,还安装了 chrome dev。我不知道这是否与这个问题有关。

uj5u.com热心网友回复:

打开 html 档案,然后运行->“启动 Chrome”。

lauch.json

{
  // 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": [            
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9003
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9003
    },
    {
      "type": "chrome",
      "request": "attach",
      "name": "Attach Chrome",
      "url": "http://localhost/${workspaceFolderBasename}/${relativeFile}",
      "webRoot": "${workspaceFolder}",
      "port": 80,
      "userDataDir": "${workspaceFolder}/.vscode/chrome",
    },
    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome",
      "url": "http://localhost/${workspaceFolderBasename}/${relativeFile}",
      "webRoot": "${workspaceFolder}",
      "userDataDir": "${workspaceFolder}/.vscode/chrome",
    },
  ]
}

uj5u.com热心网友回复:

不是您问题的直接答案,但您可以尝试使用括号 - https://brackets.io/

标签:

0 评论

发表评论

您的电子邮件地址不会被公开。 必填的字段已做标记 *