ab11
ab11

Reputation: 20100

IntelliJ NPM debug configuration not stopping on breakpoint?

I am able to run my Express app from IntelliJ by creating a debug configuration.

enter image description here

However, when I place breakpoints and post a request to my app from Postman, the app does not stop at my breakpoints, although the application does execute and handle the request.

Do I need to do something special to debug my application?

Upvotes: 0

Views: 3710

Answers (1)

lena
lena

Reputation: 93888

You have to modify your Npm script to make sure that Node.js is started with appropriate debug options (--debug-brk, --inspect-brk, etc) by passing $NODE_DEBUG_OPTION to it , as the IDE can't control the way child processes are spawned - it can only pass options to the main process when starting it. If dev is the npm script that starts the app you'd like to debug with node.js, you need to modify this script accordingly, like:

"dev": "node $NODE_DEBUG_OPTION bin/www" 

These articles might be helpful: IntelliJ IDEA how to correctly pass $NODE_DEBUG_OPTION to npm-run-all and http://pavelpolyakov.com/2016/05/01/webstorm-npm-tasks-debug/.

Upvotes: 1

Related Questions