【发布时间】:2017-09-13 05:31:05
【问题描述】:
我正在尝试将我的默认 grunt 任务附加到 vscode 调试器。所以我想要的工作流程是我启动调试器并运行默认的 grunt 任务,然后我可以使用 vscode 调试器在我的代码中放置断点。我的启动 JSON 文件如下所示。
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/node_modules/grunt/lib/grunt",
"args": ["run"],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "production"
}
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"port": 5858
}
]
}
但我收到一个错误,无法启动程序“node_modules/grunt/lib/grunt”;设置 'outfiles' 属性可能会有所帮助
【问题讨论】:
-
你的繁重任务是做什么的?它只是运行应用程序还是有编译步骤?如果是第一个,那么任务运行者已经有很多类似的问题,例如stackoverflow.com/questions/43210203/…。如果您的
run任务还编译源代码,那么您可以使用preLaunchTask选项集定义 Node.js 调试配置。 -
@jsynowiec 是后者,你能指导我如何实现这一目标
标签: javascript debugging visual-studio-code