2

I'm very new to Vagrant (just installed it yesterday). And I am trying to set my proxy settings as per this answer. I have already installed the proxyconf plugin.

I am running Windows 7 64-bit. I assumed that the Vagrantfile in question was C:\Users\<my username>\.vagrant.d\Vagrantfile. This file did not exist, so I created it with the contents set to just the three lines given in the answer linked above (with yourproxy replaced by my actual proxy of course):

config.proxy.http     = "http://yourproxy:8080"
config.proxy.https    = "http://yourproxy:8080"
config.proxy.no_proxy = "localhost,127.0.0.1"

Now I am trying to run a Vagrant command (which I got from another online tutorial)

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

When I run it, I get the following:

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

Sorry as this is probably down to my extremely limited knowledge of Vagrant, but can someone help me as to how to set it up correctly?

Adam Burley
  • 5,551
  • 4
  • 51
  • 72

1 Answers1

2

Need to put Vagrant.configure("2") do |config| before these lines and end after them. This is missed from the answer which I was quoting from.

Adam Burley
  • 5,551
  • 4
  • 51
  • 72