1. Click the debug button on the left of VSCodeOpen the debug configuration panel, and then click “Customize run and debug create launch.json file”. If the select drop-down box appears, select “Node.js debugger”.

2. There will be a new file launch.js in the.vscode folder of the project folder, modify the code of the file as follows:

{// Use IntelliSense to learn about related attributes. // Hover to view descriptions of existing properties. / / for more information, please visit: https://go.microsoft.com/fwlink/?linkid=830387 "version" : "0.2.0," "configurations: [{" type" : "Node", "request" : "launch", "name" : "start the program," "skipFiles" : [" < node_internals > / * * "], "the program" : "${workspaceFolder}\\app\\index.js", "stopOnEntry": false, "args": [ ], "cwd": "${workspaceRoot}", "preLaunchTask": null, "runtimeExecutable": "${workspaceRoot}/node_modules/electron/dist/electron.exe", "runtimeArgs": [ "--nolazy" ], "env": { "NODE_ENV": "development" }, //"externalConsole": false, "sourceMaps": false //"outDir": null } ] }Copy the code

Note that the runtimeExecutable property value in the configuration should be the correct path address for installing Electron on your computer, For example, the installation location on my computer is D:\Net_Program\Net_NodeJS\node_global\node_modules\electron\dist\electron.exe

3. At this point, we can set breakpoints in a JS file for debugging. For example, we can set breakpoints in index.js and press F5 to debug.

The complete configuration effect picture is as follows: