重现步骤:
- 使用 app.js 文件(包含几行 JavaScript 代码)创建文件夹。
- 创建默认的 launch.json
运行调试器。 Visual Studio Code 不启动调试器(似乎尝试从 HPC 包执行 node.exe) 调试控制台输出:
节点 --debug-brk=37183 --nolazy app.js 节点命令
语法: 节点{运算符} [选项] [参数]
参数: /?或/help - 显示此帮助消息。 list - 列出节点或节点历史记录或集群 listcores - 列出集群上的核心 view - 查看节点的属性 online - 将节点或节点设置为在线状态 离线 - 将节点或节点设置为离线状态 暂停 - 暂停节点 [已弃用] resume - 恢复节点 [已弃用]
有关 HPC 命令行工具的更多信息, 请参阅http://go.microsoft.com/fwlink/?LinkId=120724 .
launch.json内容:
{
“版本”:“0.2.0”,
“配置”:[
{
"name": "启动",
“类型”:“节点”,
“请求”:“启动”,
"程序": "${workspaceRoot}/app.js",
“stopOnEntry”:假,
“参数”:[],
"cwd": "${workspaceRoot}",
“preLaunchTask”:空,
“运行时可执行文件”:空,
“运行时参数”:[
“--nolazy”
],
“环境”:{
"NODE_ENV": "开发"
},
“externalConsole”:假,
“源 map ”:假,
“outDir”:空
},
{
"name": "附加",
“类型”:“节点”,
“请求”:“附加”,
“端口”:5858,
“地址”:“本地主机”,
“重新启动”:假,
“源 map ”:假,
“outDir”:空,
"localRoot": "${workspaceRoot}",
“远程根”:空
},
{
"name": "附加到进程",
“类型”:“节点”,
“请求”:“附加”,
"processId": "${command.PickProcess}",
“端口”:5858,
“源 map ”:假,
“outDir”:空
}
]
}
- VSCode 版本:
- 操作系统版本:windows7
最佳答案
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",
关于javascript - 我无法在 Visual Studio Code 中启动 "javascript"调试器(可能是因为安装了 HPC),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39314669/