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": []
}
To create a launch.json file, click the create a launch.json file link in the Run start view. If you go back to the File Explorer view (Ctrl+Shift+E), you'll see that VS Code has created a .vscode folder and added the launch.json file to your workspace.
args. JSON array of command-line arguments to pass to the program when it is launched. Example ["arg1", "arg2"] . If you are escaping characters, you will need to double escape them. For example, ["{\\\"arg1\\\": true}"] will send {"arg1": true} to your application.
Depending on your platform, the user settings file is located here: Windows %APPDATA%\Code\User\settings.json. macOS $HOME/Library/Application\ Support/Code/User/settings.json. Linux $HOME/.config/Code/User/settings.json.
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": []
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With