用于vagrant插件的VSCode launch.json

问题描述 投票:1回答:2

我尝试在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.exedir.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环境变量?

visual-studio-code vagrant-plugin
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",
...

0
投票

@sschoof如果你试图从Windows主机运行VS Code,我建议你阅读这个post

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

© www.soinside.com 2019 - 2024. All rights reserved.