Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.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
Vagrant &引用;NameError:未定义的局部变量或方法';配置';对于main:Object“;尝试设置流浪代理时_Vagrant - Fatal编程技术网

Vagrant &引用;NameError:未定义的局部变量或方法';配置';对于main:Object“;尝试设置流浪代理时

Vagrant &引用;NameError:未定义的局部变量或方法';配置';对于main:Object“;尝试设置流浪代理时,vagrant,Vagrant,我对流浪汉很陌生(昨天刚安装)。我正在尝试按照设置我的代理设置。我已经安装了proxyconf插件 我正在运行64位Windows 7。我假设所讨论的Vagrantfile是C:\Users\\\.vagrant.d\Vagrantfile。这个文件不存在,所以我创建它时,将其内容设置为上面链接的答案中给出的三行内容(当然,将yourproxy替换为我的实际代理): 现在我尝试运行一个Vagrant命令(我从另一个在线教程中获得) vagrant box add bento/centos-7——

我对流浪汉很陌生(昨天刚安装)。我正在尝试按照设置我的代理设置。我已经安装了
proxyconf
插件

我正在运行64位Windows 7。我假设所讨论的
Vagrantfile
C:\Users\\\.vagrant.d\Vagrantfile
。这个文件不存在,所以我创建它时,将其内容设置为上面链接的答案中给出的三行内容(当然,将
yourproxy
替换为我的实际代理):

现在我尝试运行一个Vagrant命令(我从另一个在线教程中获得)

vagrant box add bento/centos-7——provider=virtualbox

当我运行它时,我得到以下信息:

There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.

Path: C:/Users/<my username>/.vagrant.d/Vagrantfile
Line number: 0
Message: NameError: undefined local variable or method `config' for main:Object
加载文件时出错。正在加载的文件
错误信息如下所示。这通常是由于
语法错误。
路径:C:/Users/.vagrant.d/Vagrantfile
行号:0
消息:NameError:未定义的局部变量或main:Object的“config”方法

很抱歉,这可能是因为我对Vagrant的了解非常有限,但是有人能帮我正确设置吗?

需要将
Vagrant.configure(“2”)do | config |
放在这些行之前,并在它们之后
结束。我引用的答案没有提到这一点

There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.

Path: C:/Users/<my username>/.vagrant.d/Vagrantfile
Line number: 0
Message: NameError: undefined local variable or method `config' for main:Object