What does luanch.json config have to do with debugging?

Trying to debug my javascript code in Visual Studio. Selected “Start Debugging” and I get the following error message “configuration ‘Run Current File’ is missing in launch.json” (not pictured–error msg vanished after 5 seconds). I also got redirected to this launch.json file but have no idea what I need to type here.

I already have installed Node.js. I have restarted my computer, as well as edited the syntax of my javascript before debugging.

I am very very new to programming and am not sure what could be missing. Help please!

2 Likes

launch.json is used if your want to debug an application (by pressing F5).

Let’s say I create a new folder with a main.js file in it and press F5, I will get this window:

Now I chose Node.js and it jumps to the Debug tab and runs the main.js file

Now I can click on create a launch.json file, select Node.js again and it creates this file for me:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}\\main.js"
        }
    ]
}

But regarding your open files, you have a client side (frontend) project and not a backend (nodejs) application, since you have html and css files.
In that case you want a Live Server. I’m using this extension for it: Five Server (Live Server) - Visual Studio Marketplace