vscode与chrome调试配置与常见问题 vscode怎么调试webpack查看webpack的原理 以及 vscode调试错误提示的解决办法 ?
Cannot connect to the target at localhost:0: Could not connect to debug target at http://localhost:0: Could not find any debuggable target解决方法:1)浏览器桌面快捷方式对应图标,右键属性,找到“快捷方式”选项卡->下的目标,在 "C:\Program Files…
Cannot connect to the target at localhost:0: Could not connect to debug target at http://localhost:0: Could not find any debuggable target
解决方法:
1)浏览器桌面快捷方式对应图标,右键属性,找到“快捷方式”选项卡->下的目标,在 "C:\Program Files\Google\Chrome\Application\chrome.exe"
后添加 -remote-debugging-port=9222
变更为:"C:\Program Files\Google\Chrome\Application\chrome.exe" -remote-debugging-port=9222
launch.json
{
"name": "Attach to Chrome",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}"
}
这里的9222
对应的就是步骤(1)中在快捷方式中添加的 9222
端口。
3)通过快捷方式启动chrome浏览器,然后在cmd中输入 netstat -ano | findstr 9222
会看到对应9222端口号的进程,如下:
在任务管理器中也可以得到确认,如下:
4)在vscode中启动调试
reference
https://blog.csdn.net/a15110793402/article/details/81605839