2

I'm new to Javascript and Node.js.

Coming from C# I want to debug something like this with breakpoints set in Debugging-console:

var name = Console.readline();
Console.Writeline(name);

It seems to be so simple, but I fail. What I found so far is, that after

npm install sget 

I can run app.js in integrated terminal and it will work interactively. But that ignores my breakpoints.

So, how can I work with readline-functionality and breakpoints set?

  • http://stackoverflow.com/questions/23340968/debugging-node-js-with-node-inspector – Aᴍɪʀ Feb 01 '17 at 16:56
  • thanks for the suggestion. but it doesn't seem to be the solution that I need. @Aᴍɪʀ –  Feb 01 '17 at 17:04
  • I know, I just wanted to give you some direction about debugging nodejs projects :) – Aᴍɪʀ Feb 01 '17 at 17:05
  • Try debugging using Visual Studio Code or Webstorm. In those you can manipulate value of variable while in breaked condition and then continue execution with the new value and While the breakpoint is hit all the execution of all asynchronous code will be paused. – Nidhin David Feb 01 '17 at 17:31

2 Answers2

1

You will not be able to do that because Node is nonblocking.

You can use Node Debugger:

or Node Inspector:

You can use Chrome Developer Tools to debug Node, see:

rsp
  • 107,747
  • 29
  • 201
  • 177
0

Head over to these documentations :

these might help solve your problem.

m87
  • 4,445
  • 3
  • 16
  • 31