我正在尝试将我的默认grunt任务附加到vscode调试器。所以我期望的工作流程是启动调试器,它运行默认的grunt任务,然后我可以使用vscode调试器在我的代码中放置断点。我启动的JSON文件看起来像这样。将grunt附加到VSCODE调试器
{
"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 /咕噜/ lib目录/咕噜';设置'outfiles'属性可能有帮助
你的咕噜任务是做什么的?它只是运行应用程序还是有编译步骤?如果它是第一个,那么对于任务跑步者已经有很多类似的问题,例如, http://stackoverflow.com/questions/203/what-is-the-proper-way-to-debug-an-npm-script-using-vscode/43212281#43212281。 如果您的'run'任务也编译源代码,那么您可以使用'preLaunchTask'选项集来定义一个Node.js调试配置。 –
@jsynowiec它的后者,你能指导我如何实现这个 – lboyel