Property args is not allowed in launch.json in vscode

Sibeesh Venu picture Sibeesh Venu · Jun 24, 2018 · Viewed 7.6k times · Source

I am just trying to add some basic configuration to my launch.json file in vscode, but I am getting an error as Property args is not allowed. Below is my configuration.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "index",         
            "args": [
                "src/index.ts"
            ],
            "cwd": "${workspaceFolder}"           
        }
    ],
    "compounds": []
}

enter image description here

Answer

Sibeesh Venu picture Sibeesh Venu · Jun 24, 2018

That was a silly mistake. According to this doc

VS Code debuggers typically support launching a program in debug mode or attaching to an already running program in debug mode. Depending on the request (attach or launch) different attributes are required and VS Code's launch.json validation and suggestions should help with that.

So when I changed my request to launch from attach, everything was perfect. Only the request type launch supports the configuration args.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "index",         
            "args": [
                "src/index.ts"
            ],
            "cwd": "${workspaceFolder}"           
        }
    ],
    "compounds": []
}