我无法在 Visual Studio 代码中启动 "javascript" 调试器(可能是因为安装了 HPC)

I cannot start "javascript" debugger in Visual Studio Code (probably, because installed HPC)

重现步骤:

  1. 创建包含 app.js 文件的文件夹(有几行 javascript)。
  2. 创建默认 launch.json
  3. 运行 调试器。 Visual Studio 代码不启动调试器(似乎,尝试从 HPC 包执行 node.exe) 调试控制台输出:

    node --debug-brk=37183 --nolazy app.js 节点命令

    语法: 节点 {运算符} [选项] [参数]

    参数: /?或 /help - 显示此帮助信息。 list - 列出节点或节点历史或集群 listcores - 列出集群上的核心 view - 查看节点的属性 online - 将节点或节点设置为在线状态 offline - 将节点或节点设置为离线状态 pause - 暂停节点 [已弃用] resume - 恢复节点 [已弃用]

    有关 HPC 命令行工具的更多信息, 见 http://go.microsoft.com/fwlink/?LinkId=120724.

launch.json内容: { "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "node", "request": "launch", "program": "${workspaceRoot}/app.js", "stopOnEntry": false, "args": [], "cwd": "${workspaceRoot}", "preLaunchTask": null, "runtimeExecutable": null, "runtimeArgs": [ "--nolazy" ], "env": { "NODE_ENV": "development" }, "externalConsole": false, "sourceMaps": false, "outDir": null }, { "name": "Attach", "type": "node", "request": "attach", "port": 5858, "address": "localhost", "restart": false, "sourceMaps": false, "outDir": null, "localRoot": "${workspaceRoot}", "remoteRoot": null }, { "name": "Attach to Process", "type": "node", "request": "attach", "processId": "${command.PickProcess}", "port": 5858, "sourceMaps": false, "outDir": null } ] }

VSC 开发人员建议下一个可能的方法:

  • change your PATH so that the correct 'node' will be found first. You can verify which node is found on the path by running where node in a command prompt.
  • find the correct 'node' on your system and then add a runtimeExecutable attribute with the absolute path to your 'node' to your launch config

我更新了 launch.json 文件并解决了问题

"runtimeExecutable": "C:\Program Files\nodejs\node.exe",

https://github.com/Microsoft/vscode/issues/11540