Using the Debugger
This document walks you through the process.
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.
Next, click the icon to copy the debug URL to the clipboard:
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.
Launching your Application
Next, go back to the IDE browser tab and launch your application.
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.
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!
Have questions about this topic? Ask for help on our NodeRun Discussion Forum.