我正在嘗試將我的默認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