Running Node.js app locally
To run your Node.js application locally on your machine, you need to create a new Node.js Run/Debug configuration.
Click Edit configurations in the top right-hand corner of the IDE window or in the main menu Run.
Сlick + to add a new configuration and seleсt Node.js type.
Select this new configuration from the drop-down list on the top-right and click Run. The Run tool window with console will appear.
Debugging Node.js app locally
The same Run/Debug configuration can be used to debug your Node.js code.
The built-in Node.js debugger supports the latest features of V8 Debugger Protocol and allows you to step through the breakpoints, change values on the fly, evaluate expressions, and set watches.
Click the Debug button for the created Run/Debug configuration in the top right-hand corner of the IDE, from the Run menu or with the shortcut (Shift+F9 on Windows or Linux, Ctrl+D on Mac). A tool window with variables view, frames and watchers for your debug session will appear:
Debugging Node.js app that runs remotely
With Remote Node.js Debug configuration you can debug Node.js apps that are running remotely. You’ll be able to restart the debug session without restarting the app itself.
Select Remote Node.js Debug type when creating a new debug configuration, then specify the host you need to connect to and the port.
Now that the debug configuration is ready, select it from the drop-down list of configurations on the right and click Debug.
You’ll see the Debug tool window when the breakpoint is reached. You’ll be able to use full-featured debugger in the same way as if you were debugging your code locally.