homestead.rb:63:在`configure'中:未定义的方法`each'代表nil:NilClass(NoMethodError)

时间:2014-11-15 08:17:11

标签: laravel vagrant configure

我按照如何安装Laravel,但毕竟当我进入" vagrant up"我收到这些错误:

  

C:/Users/Renz/code/Homestead/scripts/homestead.rb:63:in configure': undefined m ethod每个&#39; for nil:NilClass(NoMethodError)           来自C:/ Users / Renz / code / Homestead / Vagrantfile:9:block in <top (requi red)>' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/c onfig/v2/loader.rb:37:in来电&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/c   onfig / v2 / loader.rb:37:在load' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/c onfig/loader.rb:103:in块中(2级)加载&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/c   onfig / loader.rb:97:在each' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/c onfig/loader.rb:97:in块中加载&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/c   onfig / loader.rb:94:in each' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/c onfig/loader.rb:94:in loading&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/v   agrantfile.rb:28:in initialize' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/e nvironment.rb:614:in new&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/e   nvironment.rb:614:vagrantfile' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/e nvironment.rb:399:in主持人&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/e   nvironment.rb:198:在block in action_runner' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/a ction/runner.rb:33:in电话&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/a   ction / runner.rb:33:in run' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/e nvironment.rb:386:in hook&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/e   nvironment.rb:596:unload' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:1 77:in确保&#39;           来自C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:1   77:在'&#39;

我尝试多次重新安装但仍然遇到同样的错误。

请帮忙,我现在真的需要解决这个问题。感谢它,谢谢。

3 个答案:

答案 0 :(得分:18)

您需要在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

答案 1 :(得分:0)

我不熟悉Homestead环境的初始化如何在Windows上运行,但是当您尝试在不初始化环境之前运行vagrant机器时会出现此类错误。

请务必输入:

init.bat

问候!

答案 2 :(得分:0)

当你的Homestead.yamel文件就像这样

时会发生这种情况
---
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

如果您评论该行或删除它,它应该可以正常工作