heug
heug

Reputation: 1142

Setting up intellij debugger to be able to break inside or step thru an NPM script

I have an NPM script that runs and ultimately generates a file in the repo.

How do I go about configuring the debugger to run it so that I am able to do such things as break inside/step thru its code after I run it on the command line.

Upvotes: 2

Views: 4504

Answers (1)

lena
lena

Reputation: 93738

If you like to start your script in command line and not from the IDE, you need using NodeJS Remote Debug run configuration:

  • modify your NPM script to make sure that your Node.js app is run with debugger, like:

    "scripts": { "start": "node --debug-brk=5858 build/app.js" }

  • create NodeJS Remote Debug run configuration, specify 5858 as a Port there

  • run npm start in console, start the debugger in the IDE

Upvotes: 1

Related Questions