How to debug a Gruntfile with breakpoints using node-inspector?
Posted
by
Kris Hollenbeck
on Stack Overflow
See other posts from Stack Overflow
or by Kris Hollenbeck
Published on 2014-06-02T18:32:04Z
Indexed on
2014/06/02
21:27 UTC
Read the original article
Hit count: 234
So I have spent the past couple days trying to get this to work with no luck. Most of the solutions I have found seem to work "okay" for debugging node applications. But I haven't had much luck debugging grunt stand alone. I would like to be able to set breakpoints in my gruntfile and either step through the code with either the browser or an IDE.
I have tried the following:
- Debugging using intelliJ IDE Using Grunt Console (Process finished with exit code 6)
- Debugging with Nodeeclipse (This sort of works okay but doesn't hit the breakpoints set in eclipse, not very intuitive)
- Debugging using node-inspector (This one also sort of works. I can step through a little ways using F11 and F10 in chrome. But eventually it just crashes. Using F8 to skip to break point never works.)
ERROR MESSAGE USING NODE-INSPECTOR
So currently node-inspector feels like it has gotten me the closest to what I want. To get here I did the following:
From my grunt directory I ran the following commands:
grunt node-inspector
node --debug-brk Gruntfile.js
And then from there I went to localhost:8080/debug?port=5858
to debug my Gruntfile.js. But like I mentioned above, as soon as I hit F8 to skip to breakpoint it crashes with the above error. Has anybody had any success using this method to try to debug a Gruntfile? So far from my search efforts I have not found a very well documented way of doing this. So hopefully this will be useful or beneficial information for future users. Also I am using Windows 7 by the way. Thanks in advance.
© Stack Overflow or respective owner