【问题标题】:Property args is not allowed in launch.json in vscodevscode 中的 launch.json 中不允许使用属性 args
【发布时间】:2018-12-03 01:32:51
【问题描述】:

我只是想在vscode 中的launch.json 文件中添加一些基本配置,但由于不允许使用属性参数而出现错误。 以下是我的配置。

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

【问题讨论】:

    标签: json typescript visual-studio-code vscode-settings vscode-debugger


    【解决方案1】:

    这是一个愚蠢的错误。据此doc

    VS Code 调试器通常支持在调试模式下启动程序 或附加到已在调试模式下运行的程序。根据 请求(附加或启动)需要不同的属性,并且 VS Code 的 launch.json 验证和建议应该有助于 那个。

    所以当我将请求从 attach 更改为 launch 时,一切都很完美。只有请求类型launch支持配置args

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

    【讨论】:

      猜你喜欢
      • 2020-10-01
      • 2020-10-10
      • 2021-04-14
      • 2021-10-22
      • 1970-01-01
      • 2014-05-29
      • 1970-01-01
      • 1970-01-01
      • 2014-05-23
      相关资源
      最近更新 更多