我在需要调试的 docker 容器内运行一个进程。该进程在 docker 的入口点 via 启动
dlv debug /go/src/path/to/package --headless --listen=:2345 --log,以便稍后在 VSCode 中启用调试。
docker 容器通过 启动
docker run --rm -it -p 2345:2345 my_image:tag。注意 delve 的端口是暴露的。
在VSCode中我定义launch.json如下:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach remote",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 2345,
"host": "127.0.0.1",
"apiVersion": 1
}
]
}
Run Code Online (Sandbox Code Playgroud)
虽然不是很清楚,但该 UI 让我相信我现在已连接到远程无头调试器并准备好进行调试。我定义了一个断点,我知道该断点会被我可以发送远程进程的请求击中。我发送该请求,得到结果,并且该断点从未命中,表明我尚未实现远程调试。
我的 VSCode“附加远程”配置有问题吗?我可以进行命令行调试,dlv connect :2345并且实际上可以很好地调试远程进程,这表明无头服务器功能正常。我宁愿在 VSCode 中使用源代码进行调试。
In a project there are a number of helper utilities. In the launch and tasks json files they are configured to allow the user to select the particular utility to build or debug. What I would like to do is have the selection from launch to be passed to the tasks and the task use that selection. The launch.json configuration file looks like:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug: <Utility App>",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/apps/${input:utility}/${input:utility}", …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 vs code 中调试打字稿。据我研究,您需要在 vs code 的 launch.config 中设置 outfiles 属性,以映射您在已编译的 .js 文件中在 TypeScript 文件中设置的断点,如此处指定。
当我尝试设置我的时,出现以下错误:
我在谷歌中没有发现任何关于此错误的信息,因为打字稿调试器需要此设置才能工作,正如VS Code 文档中所示。
预先感谢您的任何帮助。
编辑:
启动.json:
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"preLaunchTask": "tsc",
"sourceMaps": true
}
]
Run Code Online (Sandbox Code Playgroud)
ts配置:
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' …Run Code Online (Sandbox Code Playgroud) 我正在开发一个 Node.js 应用程序,使用express.js 作为监听 PORT 3000 的 Web 框架。我使用的是 VS Code v1.46。
我的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": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\WebApi\\index.js",
"restart": true,
"protocol": "inspector"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我能够第一次启动调试会话,但第二次开始,我收到错误Error: Listen EADDRINUSE: 地址已在使用 :::3000
此错误是因为 VSCode 没有终止在第一个调试会话中创建的 node.exe 进程,因此在后续会话中,节点无法在端口 3000 上启动 Express 服务器,因为该服务器仍在使用中。
谁能帮我配置 VSCode 以在停止调试器后终止 node.exe 进程?
自从昨天更新到 以来1.47.0,当 VSCode 启动时,它会在终端中给出以下输出(没有随后的提示让我输入):
Debugger listening on ws://127.0.0.1:55430/f3f20387-0605-4a39-b807-77f02bea362f
For help, see: https://nodejs.org/en/docs/inspector
Run Code Online (Sandbox Code Playgroud)
我通常的程序是:
code .npm run serve然后,我将通过键入(package.json has )在 VSCode 终端 (bash) 中启动我的服务器"serve": "vue-cli-service serve"。但是,现在有一些调试器和检查器持续运行,我显然不能这样做?launch.json这是显示我的空白和终端的屏幕截图:
有人可以告诉我如何解决这个问题吗?我不知道出了什么问题,但它似乎只发生在我打开的这个特定项目中code .
所以我尝试了更多的事情。
cp -rf testsite testfrontend我在 WSL 内跑步package-lock.json中node_modulesnpm installcode .然后,我通过在 WSL 中复制的项目的目录中运行来启动 VSCode当 vscode 出现时,终端没有显示。当我展示它时(ctrl+`),以下几行会自动运行:
我应该提到,当我直接从 WSL 运行时,我没有遇到此错误或任何其他上述问题npm run serve。WSL: Ubuntu如果我单击左下角的绿色按钮,然后选择Remote-WSL: …
I try to edit a vscode extension, update and add some customization, but when I debug it by pressing F5, my changes seem like not being executed. Even when I try to remove a piece of code that I am sure will break the extension, but unfotunately it still run like there are no changes at all. Am I wrong debugging it or there's caches that we should remove?
Btw I am using VSCode 1.52.1 on Ubuntu 18.04.
My …
我写了一个shell脚本,它会在启动python程序之前先做一些配置。(例如,下载数据,pip安装一些包,设置环境变量等。然后在python程序内部完成繁重的工作(例如,深度学习训练任务)。现在我想调试python程序,(我'如果我必须同时调试 shell 和 python,我可以接受)。我应该如何修改文件launch.json来完成此操作?我应该添加一些 task.json 项吗?我还不熟悉该任务主题。
目前,我正在以一种丑陋的解决方法来做这件事。我把shell脚本中的语句注释掉python train.py,先运行shell脚本。python train.py然后在调试模式下单独运行 python scipt 。我认为这目前适用于我的简单情况,但如果在 shell 脚本内部,我们正在做一些诸如临时修改环境变量之类的事情,我无法将这两个步骤分开。所以我想知道是否有更直接、更体面的方法。非常感激。
我想像Python往常一样通过按VS-Code下来调试我的本地代码:Windows 10F5
我一年多前就开始出现这个错误,但最近它变得持续存在。
整个错误回溯:
$ /usr/bin/env 'DEBUGPY_LOG_DIR=c:\Users\username\.vscode\extensions\ms-python.python-2021.8.1105858891' c:\\Users\\username\\Projects\\project-venv\\Scripts\\python.exe c:\\Users\\username\\.vscode\\extensions\\ms-python.python-2021.8.1105858891\\pythonFiles\\lib\\python\\debugpy\\launcher 56721 -- c:\\Users\\username\\Projects\\project\\test_files\\prediction_performance_monitoring\\modified_app_for_docker_testing.py
Traceback (most recent call last):
File "C:\Users\username\.pyenv\pyenv-win\versions\3.8.9\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\username\.pyenv\pyenv-win\versions\3.8.9\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\username\.vscode\extensions\ms-python.python-2021.8.1105858891\pythonFiles\lib\python\debugpy\launcher\__main__.py", line 97, in
<module>
main()
File "c:\Users\username\.vscode\extensions\ms-python.python-2021.8.1105858891\pythonFiles\lib\python\debugpy\launcher\__main__.py", line 53, in
main
launcher.connect(host, port)
File "c:\Users\username\.vscode\extensions\ms-python.python-2021.8.1105858891\pythonFiles\lib\python\debugpy\launcher/../..\debugpy\launcher\__init__.py", line 34, in connect
sock.connect((host, port))
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
Run Code Online (Sandbox Code Playgroud)
.vscode/launch.json …
python-3.x connection-refused visual-studio-code vscode-debugger
我有一个前端有 React 、后端有 .Net Core 的应用程序,我正在尝试调试我的 React 前端,没有扩展和附加到进程,但我收到以下消息错误:
\n\n\n无法连接到 localhost:3000 处的目标:无法连接到 http:localhost:3000 处的调试目标:找不到任何可调试目标。
\n
我正在使用这个launch.json:
{\n "version": "0.2.0",\n "configurations": [\n {\n "name": "Debug FrontEnd",\n "port": 3000,\n "request": "attach",\n "type": "chrome",\n "webRoot": "${workspaceFolder}"\n },\n {\n "name": "Debug BackEnd",\n "type": "coreclr",\n "request": "attach"\n }\n ]\n}\nRun Code Online (Sandbox Code Playgroud)\n我npm start基本上使用witch启动我的前端react-scripts start。
观察:I\xe1\xb8\xbf 使用 Opera 浏览器。
\nlaunch javascript-debugger reactjs .net-core vscode-debugger
打开 vscode 时,无法初始化 linting 设置
2023-11-02 21:04:46.011 [错误] 已弃用以下设置:“python.linting.flake8Enabled” 2023-11-02 21:04:46.011 [错误] 所有以“python.linting”开头的设置。已弃用,可以从设置中删除。2023-11-02 21:04:46.011 [错误] Linting 功能已移至单独的 linter 扩展。2023-11-02 21:04:46.011 [错误] 请参阅此处了解更多信息:https://code.visualstudio.com/docs/python/linting 2023-11-02 21:04:46.012 [错误] 请安装“ flake8”扩展名:https://marketplace.visualstudio.com/items? itemName=ms-python.flake8
这是什么原因以及如何解决这个问题
vscode-debugger ×10
.net-core ×1
delve ×1
go ×1
launch ×1
node.js ×1
python-3.x ×1
reactjs ×1
typescript ×1
vscode-tasks ×1
vue.js ×1
webpack ×1