我只是想在 vscode
中向我的 launch.json
文件添加一些基本配置,但我收到错误消息,因为 Property args is not allowed . 下面是我的配置。
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "index",
"args": [
"src/index.ts"
],
"cwd": "${workspaceFolder}"
}
],
"compounds": []
}
最佳答案
这是一个愚蠢的错误。根据这个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.
因此,当我将请求从 attach
更改为 launch
时,一切都很完美。只有请求类型launch
支持配置args
。
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "index",
"args": [
"src/index.ts"
],
"cwd": "${workspaceFolder}"
}
],
"compounds": []
}
关于json - vscode 的 launch.json 中不允许使用属性参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51007130/