我已经在Windows 10系统上安装了Ubuntu 20.04。在我第一次从Ubuntu内部运行VS Code之前,VS Code在Windows上运行良好。现在,我可以在那里构建我的C ++应用程序,但是无法对其进行调试。我收到一个警告框,提示“在PATH上找不到运行时'节点'。是否已安装'节点'?”
每当我启动VS Code时,也会启动一个称为“节点”的后台进程,因此我认为VS Code会启动它。我的Ubuntu安装在〜/ .vscode-server的各个子目录中都有大约八个版本的node.js。
这是我的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}/gametest",
"skipFiles": [
"<node_internals>/**"
]
},
]
}
我尝试安装最新的nodejs。我不再收到带有未找到消息的警报框,但是VS Code中的调试控制台现在显示:
/usr/bin/node /home/jon/projects/KSolve/gametest
Debugger listening on ws://127..... (can't copy from debug console window)
For help, ...
/home/jon/projects/KSolve/gametest:1
ELF(three squares)
^
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
...
...
Process exited with code 1
答案 0 :(得分:0)
前一段时间,对我来说,在WSL Ubuntu下在VS Code上运行调试器也很棘手。经过多次尝试,我得到了下一个.vscode/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": "test tree",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/tests/ttree",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/tests",
"environment": [],
"externalConsole": false,
"targetArchitecture": "x86_64",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}