CrazySynthax
CrazySynthax

Reputation: 15054

Why does nodejs debugger ignore breakpoints when it's run in npm configuration?

I have a node.js code in WebStorm. I debug the code by using node.js configuration and it works fine.

However, once I run debug mode in npm configuration, WebStorm ignores the breakpoints. I tried to add the variables "--debug" and "--debug-brk" to 'Arguments' field and it still didn't solve the problem.

enter image description here

Upvotes: 1

Views: 594

Answers (2)

Sergey.Simonchik
Sergey.Simonchik

Reputation: 1041

You need to add $NODE_DEBUG_OPTION (or %NODE_DEBUG_OPTION% on Windows) in your npm script. Please note that NODE_DEBUG_OPTION should be placed right after node, where node parameters are expected, for example:

  "scripts": {
    "start": "node $NODE_DEBUG_OPTION ./bin/www"
  }

Upvotes: 0

Ekaterina Prigara
Ekaterina Prigara

Reputation: 4977

Please check out this tutorial: http://pavelpolyakov.com/2016/05/01/webstorm-npm-tasks-debug/ You need to add $NODE_DEBUG_OPTION in your npm script. Here's the original issue on the WebStorm tracker.

Upvotes: 1

Related Questions