Start the debugger session
Any debugger session is based on a run/debug configuration. The configuration type depends on the type of your application and the runtime environment.
You can run several debugger sessions with different configurations at a time.
Through a configuration you do not only launch your application but can also tell WebStorm to use some parameters or perform some actions before the application starts. For example, you can pass Node.js-specific command line options to the Node.js executable file.
Set the breakpoints in your code.
Select the required configuration from the Select run/debug configuration list on the toolbar and click next to the list.
If your application is running in the development mode on
localhost, you can start debugging it from the built-in Terminal (Alt+F12), from the Run tool window, or from the Debug tool window. Just hold Control+Shift and click the URL at which the application is running.
You can also attach the debugger to a running Node.js application from the built-in Terminal (Alt+F12) or from the Run tool window. To start debugging, hold Control+Shift and click the URL link in the information message
Debugger listening <host>:<port>.
Learn more from Debugging a running Node.js application.
Note that after you launch a debugger session, the icon that marks the Debug Tool Window toggles to to indicate that the debugging process is active.
Pause/Resume a debugger session
When the debugger session is running, you can pause/resume it as required using the buttons on the toolbar of the Debug tool window:
To pause a debugger session, click .
To resume a debugger session, click F9.
Restart a debugger session
Click the Rerun button in the Debug tool window or press Control+F5.
Reload the current page in browser
Click . All the previous output is cleared and the debugger returns to the first breakpoint. Learn more from Reload the current page in browser.
Terminate a debugger session
Click the Stop button in the Debug tool window. Alternatively, press Control+F2 and select the process to terminate (if there are two or more of them).
- Debug non-responding applications
In case your application hung, pause the session to let the debugger get the information about its current state. You can then examine the program state and locate the cause of the problem.
- Do more with pause
When you need to evaluate an expression, and WebStorm doesn't let you do that because you didn't stop at a breakpoint, you can advance your program a line further by stepping. After this, you will be able to use the debugger as if you had stopped at a breakpoint. While in some cases this may not be a valid solution, it may sometimes help you out.
- Run before-launch tasks