laravel 在 Vagrant VirtualBox 上启用 GUI - 未定义的局部变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24230634/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Enabling GUI on Vagrant VirtualBox - undefined local variable
提问by nwi_justin
I'm new to vagrant/homestead, and I'm trying to debug the box that was created using vagrant up as the connection is on a timeout loop. I'm trying to enable the GUI. I've tried adding the config from the vagrant site and every variation of it to my vagrantfile:
我是 vagrant/homestead 的新手,我正在尝试调试使用 vagrant up 创建的框,因为连接处于超时循环中。我正在尝试启用 GUI。我已经尝试将来自 vagrant 站点的配置及其每个变体添加到我的 vagrantfile 中:
config.vm.provider "virtualbox" do |v|
v.gui = true
end
But whenever this is in there and I run vagrant up or reload, it just returns "Message: undefined local variable or method 'config' for main:Object"
但是每当它在那里并且我运行 vagrant up 或重新加载时,它就会返回 "Message: undefined local variable or method 'config' for main:Object"
Any ideas? Thanks in advance!
有任何想法吗?提前致谢!
回答by Sonique
Recently I had the same problem, in my case this is because I put this code outside the main vagrant config block, try to put in the proper place like in example. First line define local variable config
which used inside the block:
最近我遇到了同样的问题,在我的情况下,这是因为我将此代码放在主 vagrant 配置块之外,尝试像示例中那样放在适当的位置。第一行定义config
在块内使用的局部变量:
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
// other configs
config.vm.provider "virtualbox" do |v|
v.gui = true
end
end