How to debug a nodejs application in Webstorm served using nodemon via a Gulp task Follow
I have a gulp task that serves my application using nodemon. I would like to be able to debug my node application, but am unsure how to go about this in Webstorm.
I saw somewhere when Googling around to try running my gulp task first in webstorm and then a nodejs remote debugging task. I have tried this, point the config of the remote task to my localhost and port which nodemon serves at, but still this has made no difference when trying to hit breakpoints in my node application code.
Can anyone offer me any suggestions of other things to try please?
Please sign in to leave a comment.
If you need using Gulp + Nodemon (instead of using WebStorm own functionality that allows restarting Node server on changing the code - see https://blog.jetbrains.com/webstorm/2014/08/live-edit-updates-in-webstorm-9/), you need to make sure that all child processes are spawned with --debug-brk option - otherwise WebStorm debugger won't be able to attach to them. This has to be done in code. Also, I'd suggest using Node.js run configuration for debugging, as Gulp run configuration doesn't provide support for debugging child processes, it can only be used for debugging gulp tasks, but not applications spawned by Gulp