Renz
Renz

Reputation: 187

homestead.rb:63:in `configure': undefined method `each' for nil:NilClass (NoMethodError)

I followed how to install Laravel but after all when I entered "vagrant up" i get these errors:

C:/Users/Renz/code/Homestead/scripts/homestead.rb:63:in `configure':
undefined m ethod `each' for nil:NilClass (NoMethodError)
   from C:/Users/Renz/code/Homestead/Vagrantfile:9:in `block in <top (requi red)>'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/v2/loader.rb:37:in `call'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/v2/loader.rb:37:in `load'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:103:in `block (2 levels) in load'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:97:in `each'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:97:in `block in load'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:94:in `each'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:94:in `load'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/vagrantfile.rb:28:in `initialize'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:614:in `new'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:614:in `vagrantfile'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:399:in `host'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:198:in `block in action_runner'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:33:in `call'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:33:in `run'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:386:in `hook'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:596:in `unload'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:177:in `ensure in <main>'
   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:177:in `<main>'

I tried re-installing multiple times but still get the same error.

Please help, I really need to fix this now. Appreciate it, thanks.

Upvotes: 6

Views: 9940

Answers (3)

Seyed Hussein Mirzaki
Seyed Hussein Mirzaki

Reputation: 361

It happens when your Homestead.yamel file is like this

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code/testprogram
      to: /home/vagrant/testprogram

sites:
    - map: test.app
      to: /home/vagrant/test/public
ports: < This line should be comment too<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#   - send: 80
#     to: 80

if you comment that line or delete it the it should work fine

Upvotes: 2

freddyiniguez
freddyiniguez

Reputation: 51

I am not pretty familiar how initialization of the Homestead environment works on Windows, but this kind of error appears when you try to run the vagrant machine without initialize the environment before.

Just be sure you typed:

init.bat

Regards!

Upvotes: 0

Jon McEroy
Jon McEroy

Reputation: 515

You need to have a database added to your Homestead.yaml:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code/testprogram
      to: /home/vagrant/testprogram

sites:
    - map: test.app
      to: /home/vagrant/test/public

databases:
    - name: testprogram

variables:
    - key: APP_ENV
      value: local

Upvotes: 21

Related Questions