NodeJS debugger Tool

When you are working on any programing languages or frameworks, what you need to take care that is how to debug it while developing. And lucky for us, NodeJS has powerful debugging features build in, which is very helpful.

To start NodeJS debugger, you run the command below:

$ node inspect app.js
< Debugger listening on ws://127.0.0.1:9229/15049088-2c78-4704-b145-80c635667b4b
< For help, see: https://nodejs.org/en/docs/inspector
< Debugger attached.
Break on start in app.js:1
> 1 console.log("Hi")
  2 
debug> 

For now, you can do many commands here to debug the NodeJS script app.js, for example, you type help command to list all functions of debugger:

  • If you want set a breakpoint, you need to use sb(line number):
  • If you want reset a breakpoint, you need to use cb(line number).
  • List all breakpoints with breakpoints command.

You should try almost commands which you want from your script and see the result. Thanks for reading!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s