Codementor Events

Interactively Debug Node.js Applications with Chrome Dev Tools

Published Mar 21, 2017
Interactively Debug Node.js Applications with Chrome Dev Tools

Interactively Debugging Node.js Applications in Chrome Dev Tools

Debugging Node.js has always been a pain — using console.log statements for debugging and checking variable values is time consuming and inefficient. The new debugging feature (experimental) is now available and supported in latest Node.js versions.

Here’s how to get up and running:

1. Download and install the current version of Node.js

You can install it manually from the Node.js website but I recommend using nvm to install the latest:

nvm install node

2. Run you Application with --inspect flag

You can also break on the first statement of the script with --debug-brk
I am using the Tube2Gif application for demo.
57485326-7ffd-4050-8598-26c20c9975b2.png

3. Navigate to the generated URL in chrome

Screenshot_2017-03-14_17-44-56.png

Locate the file you wish to inspect in sources and add breakpoints on the lines.

4. Execute that file by going to the appropriate URL

In my case, I'm searching for keyterms executes search.js
Screenshot_2017-03-14_17-45-38.png

As you click the search button, the execution is paused in Chrome debugger and you can inspect all variable and stack from there.

Screenshot_2017-03-14_20-26-32.png


If you'd like to discuss any of the above, need help, or would like to know where to go from here, let me know in the Codementor chat!

Discover and read more posts from Kumar Uttpal
get started
post commentsBe the first to share your opinion
june07
7 years ago

This tool works well with the above workflow and in fact helps improve it. http://june07.com/nim

http://june07.com/inspect-b…

Show more replies