1

我尝试在 Windows 上为 vagrant-plugin 设置launch.json。我当前的版本如下所示:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Vagrant",
            "type": "Ruby",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "program": "${workspaceRoot}/bin/vagrant",
            "args": ["up"],
            "env": {
                "VAGRANT_CWD": "${workspaceRoot}/development"
            }
        }
    ]
}

现在启动插件时,vagrant 错过了外部依赖项。所以我得到了错误:

The executable 'curl' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.

将所需的依赖项添加到我的路径听起来很麻烦(cp.exe, dir.exe, ...)。

我试过了:

        "env": {
            "PATH": "/HashiCorp/Vagrant/embedded/bin;${PATH}",
            "VAGRANT_CWD": "${workspaceRoot}/development"
        }

但后来我明白了Debugger terminal error: Process failed: spawn rdebug-ide.bat ENOENT

有没有办法在launch.json中扩展PATH环境变量?

4

2 回答 2

0

对于以下问题:

有没有办法在launch.json中扩展PATH环境变量?

从文档中:

您还可以通过 ${env.Name} 引用环境变量(例如 ${env.PATH})。确保匹配环境变量名称的大小写,例如 Windows 上的 env.Path。

在:http ://code.visualstudio.com/docs/editor/tasks#_variable-substitution

例如,我经常在 Visual Studio Code 的 launch.json 中将其用于 Ruby 应用程序:

...
"pathToBundler": "${env.HOME}/.rvm/gems/ruby-2.3.0/wrappers/bundle",
...
于 2016-11-29T05:40:28.720 回答
0

@sschoof 如果您尝试从 Windows 主机运行 VS Code,我建议您阅读这篇文章

我目前刚刚开始使用我的 Mac OSX 主机配置开发工作区以用于 nodejs、VS Code 和 Azure。我的解决方案正在运行,但我还没有完成 Windows 实现,所以我目前无法提供更有经验的建议。

于 2016-09-12T11:08:35.883 回答