Debugging exception on grunt scripts

I have an exception that happens with one task of the gruntfile.
So I have been desperately looking for ways to debug this issue.

I am still not close to a solution but a nice start was being able to use the VS Code to try some debugging.

How to do it:

  1. Press the Bug icon bug icon
  2. Select Add Configuration from dropdown
  3. Use the intellisense. For grunt I used the launch program snippet
  4. Use the folliwing snippets for grunt:
 {
            "type": "node",
            "request": "launch",
            "name": "Launch Grunt",
            "args": ["serve"],            
            "program": "${env:APPDATA}\\npm\\node_modules\\grunt-cli\\bin\\grunt", 
            "stopOnEntry": true,
            "cwd": "${workspaceRoot}"
        }

I'm still learning so probably there will be more posts :P