< Previous Article Next Article >

Using the Debugger

Most developers are familiar with client-side JavaScript debugging using Chrome Developer Tools or similar utilities in other browsers. NodeRun makes debugging your server-side Node.js code just as simple.

This document walks you through the process.

Starting Debug

Before you can debug server-side code, your Node.js server must be started for debugging. Simply select the Start Debug... option on the Server menu.

screenshot

Next, click the icon to copy the debug URL to the clipboard:

screenshot

Opening the Debugger

To open the debugger, follow these steps:

  • Start a new browser tab in Google Chrome.
  • Make sure Developer tools are open (use Ctrl+Shift+I to toggle Developer tools).
  • Paste the URL you copied in the previous step into the browser's address bar and press enter.
  • Once connected, you can close Developer tools. The main browser window will be your Node.js debugger interface.
  • Navigate to the Sources tab and select the Page tab below it, then expand the tree to see JavaScript files.

screenshot

Launching your Application

Next, go back to the IDE browser tab and launch your application.

screenshot

Once the application is launched and your server-side code is triggered, your Node.js file(s) will be loaded and shown at the top of the tree in the Debugger tab. Select the file you would like to debug and your Node.js source code will appear.

screenshot

Setting Breakpoints

You can now set breakpoints by clicking on the line numbers. Alternatively, you can place the debugger; keyword in your code to initiate a breakpoint.

You may switch back and forth between the Debugger tab and the application. Once a breakpoint is hit, you can start stepping through the code, evaluating variables, and more!

screenshot

Questions?

Have questions about this topic? Ask for help on our NodeRun Discussion Forum.

< Previous Article Next Article >