Home > Blockchain >  VS Code can't connect to Google Chrome for html debug
VS Code can't connect to Google Chrome for html debug

Time:01-17

I'm having issues connecting to chrome through html vscode debug. each time I go to the run menu and click on 'start debugging' or 'run without debugging', google chrome opens and shows new tab and not the file I'm debugging. When I return to vscode, I find out that the call stack is empty. I've also tried using a launch.json file. I haven't encountered this problem before. I was able to debug html with chrome without the chrome debugger extension(now deprecated). I don't know why I'm having these issues now. Please can someone help me fix this issue? Thanks.

NOTE: I recently uninstalled and installed the latest version of chrome and also installed chrome dev. I don't know if that has anything to do with this issue.

CodePudding user response:

Open the html file and then Run-> "Launch 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",
    },
  ]
}

CodePudding user response:

Not a direct answer to your question, but you could try using brackets - https://brackets.io/

  •  Tags:  
  • Related