本文介绍了vscode中的launch.json中不允许使用属性args的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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": []
}

推荐答案

那是一个愚蠢的错误.根据此文档

That was a silly mistake. According to this doc

因此,当我将请求从attach更改为launch时,一切都非常完美.仅请求类型launch支持配置args.

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": []
}

这篇关于vscode中的launch.json中不允许使用属性args的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 12:05