2015-09-07 39 views
7

箱子工作正常。然后我停下了一个(当时唯一一个在跑),现在我无法让他们中的任何一个回来。Vagrant配置错误 - “必须指定一个框。”


运行vagrant up [name]给我下面的错误,无论哪个我挑或是我离开它vagrant up他们都上来:

There are errors in the configuration of this machine. Please fix 
the following errors and try again: 

vm: 
* A box must be specified. 

运行最新版本的流浪的(1.7.4 )。

这是我Vagrantfile的全部,包括(以防万一)注释:运行vagrant status

# Search for boxes here: https://atlas.hashicorp.com/boxes/search 
# Refer to commands_vagrant.txt for command reference 

Vagrant.configure("2") do |config| 

    # Globally defined variables 
    config.vm.synced_folder "./", "/var/www/public" 

    # CentOS 6.5, Apache 2.2.15, MySQL 5.5.36 (-u root), PHP 5.3.28 
    # Note: If PHP session keys don't work, set permissions to 777 (or other more restrictive, but this is guaranteed to work) on /var/lib/php/session 
    config.vm.define "php5dot3", primary: true do |php5dot3| 
     config.vm.box = "smallhadroncollider/centos-6.5-lamp" 
     config.vm.network :forwarded_port, guest: 80, host: 4567 
    end 

    # Ubuntu 14.04 (SSH pw: vagrant), Apache 2.4.12, MySQL 5.5.43 (-u root -p root), PHP 5.6.10 
    config.vm.define "php5dot6" do |php5dot6| 
     config.vm.box = "scotch/box" 
     config.vm.network :forwarded_port, guest: 80, host: 4568 
    end 

end 

结果:

Current machine states: 

php5dot3     poweroff (virtualbox) 
php5dot6     poweroff (virtualbox) 

运行vagrant global-status的结果:

id  name  provider state directory       
-------------------------------------------------------------------------- 
e1f3c85 default virtualbox poweroff /home/sam/Web      
c588d51 php5dot6 virtualbox poweroff /home/sam/Web      
4e71c50 php5dot3 virtualbox poweroff /home/sam/Web  

“默认”是单数箱我在Vagrantfile收到我多机上周工作。 (有关?)


运行vagrant box list的结果:

scotch/box       (virtualbox, 2.0) 
smallhadroncollider/centos-6.5-lamp (virtualbox, 1.0.0) 

任何帮助,将不胜感激,谢谢。

+0

我在这里创建了类似的问题:https://github.com/mitchellh/vagrant/issues/6245 – generalconsensus

+0

你运行过'bash init.sh'吗?前? – RidRoid

+0

不,永远不会运行在任何有关的bash脚本放浪。 – SamHH

回答

14

里面的机器定义,您需要使用机器的变量名,而不是config。尝试了这一点:

在下面的文件,我已经改变了config.vm要么php5dot3.vmphp5dot6.vm

Vagrant.configure("2") do |config| 

    # Globally defined variables 
    config.vm.synced_folder "./", "/var/www/public" 

    # CentOS 6.5, Apache 2.2.15, MySQL 5.5.36 (-u root), PHP 5.3.28 
    # Note: If PHP session keys don't work, set permissions to 777 (or other more restrictive, but this is guaranteed to work) on /var/lib/php/session 
    config.vm.define "php5dot3", primary: true do |php5dot3| 
     php5dot3.vm.box = "smallhadroncollider/centos-6.5-lamp" 
     php5dot3.vm.network :forwarded_port, guest: 80, host: 4567 
    end 

    # Ubuntu 14.04 (SSH pw: vagrant), Apache 2.4.12, MySQL 5.5.43 (-u root -p root), PHP 5.6.10 
    config.vm.define "php5dot6", autostart:false do |php5dot6| 
     php5dot6.vm.box = "scotch/box" 
     php5dot6.vm.network :forwarded_port, guest: 80, host: 4568 
    end 

end 

我还添加了autostart:falsephp5dot6盒子,里面定义的,如果你愿意,你可以删除。 (这只是意味着运行vagrant up只会默认启动主服务器

+0

这似乎已经解决了我与Vagrant长期存在的问题,非常感谢! – SamHH

+1

希望您不必等待4个月才能解决问题! –

+1

Bright side?问题解决了!翻转的一面?...我怎么不知道这个......:/ –

相关问题