How can I debug a Node.js application working with PM2 in VSCode?

Visual Studio code contains some amazing debugging features that make it easy to debug applications using node. However, my application is configured to use PM2. How can I configure Visual Studio code for debugging with PM2?

+5
source share
1 answer

You can add the launch configuration to VSCode in a file called launch.json that joins the process you want:

{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "attach", "name": "Attach to Process", "processId": "${command:PickProcess}" }, {...} ] } 

Press ctrl + shift + D to display the debug section in Visual Studio code, select Attach to Process , and then click play . VSCode will automatically show you the available options on your local computer. In addition to process IDs of running processes, node VSCode shows the full path to your node application, so it’s easy to choose the appropriate process to join.

+4
source

Source: https://habr.com/ru/post/1260783/


All Articles