4

I have npm run script in package.json:

"scripts": { "start": "nodemon lib/app.js --exec babel-node --presets es2015,stage-2" } 

How do you start a debugging session on WebStorm with this script?

2 Answers 2

5

Right-click on package.json in the Project view and select "Show npm Scripts":

enter image description here

This will display the npm Tool Window with a list of your scripts. Right-click on a script and select Debug 'start' (for example):

enter image description here

NPM Tool Window

For the debugger to work (so that it stops at breakpoints, etc.) you need to add the string $NODE_DEBUG_OPTION to the script definition, for example:

"scripts": { blah: node $NODE_DEBUG_OPTION blah.js } 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for a quick response! I'm able to run the script that way but it doesn't stop at breakpoints. Is it the way Webstorm is supposed to work?
$NODE_DEBUG_OPTION didn't help me here either. It turned out that it is babel-node issue.
3

It turns out the debug on WebStorm doesn't work with babel-node because babel-node does NOT output the transformed code. The issue tracker is here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.