正如标题中所述,我在尝试使用VSCode调试器与Live一起调试JavaScript应用程序时遇到了问题,我一直得到:
Cannot connect to the target at localhost:9222: Could not connect to debug target at http://localhost:9222: Could not find any debuggable target.
当我打开我的launch.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": "Attach to Chrome",
"port": 9222,
"request": "attach",
"type": "pwa-chrome",
"webRoot": "${workspaceFolder}"
}
]
}
在VSCode的settings.json中,我有:
"liveServer.settings.AdvanceCustomBrowserCmdLine": "chrome --remote-debugging-port=9222"
我在互联网上到处都找过了,似乎什么都不管用,这里和那里都有一些帖子,但它们有点老了,他们要求下载用于VSCode的chrome调试器扩展,但是自从VSCode现在有了它,它就被废弃了。我确实试过安装它,但没有改变任何东西。活动服务器正在端口5500上运行。
希望有人能够帮助我,我想摆脱在任何地方使用console.log()
。
发布于 2022-10-20 06:24:34
**解决了**我的同事帮助我做了这个,我必须右键点击铬然后右击铬配置文件,然后转到属性,这将打开属性窗口,最后添加--remote-debugging-port=9222
在“目标”选项在快捷标签。
https://stackoverflow.com/questions/71417778
复制相似问题