Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 无法从扩展名使用VSCode CLI_Visual Studio Code_Command Line Interface_Vscode Extensions - Fatal编程技术网

Visual studio code 无法从扩展名使用VSCode CLI

Visual studio code 无法从扩展名使用VSCode CLI,visual-studio-code,command-line-interface,vscode-extensions,Visual Studio Code,Command Line Interface,Vscode Extensions,我试图创建一个扩展,并希望在child_进程中使用“code--version”,但它始终是“node”的返回版本。通过命令行,我可以使用代码——版本没有任何问题 代码:- var output = child.spawnSync("code",['--version']); vscode.window.showInformationMessage(`${output.stdout}.`) 我注意到的一点是,“代码”始终被视为子进程中的“节点”。有人能帮我找出这个问题的原因

我试图创建一个扩展,并希望在child_进程中使用“code--version”,但它始终是“node”的返回版本。通过命令行,我可以使用代码——版本没有任何问题

代码:-

var output = child.spawnSync("code",['--version']);
vscode.window.showInformationMessage(`${output.stdout}.`)
我注意到的一点是,“代码”始终被视为子进程中的“节点”。有人能帮我找出这个问题的原因吗

多谢各位。
Chaithanya发现进程正在VSCode安装文件夹下运行,该文件夹中有code.exe。将代码更改为以下行后,它开始按预期工作

const bat = child.execSync('bin\\code --list-extensions');
console.error(bat.toString());
多谢各位