Vagrant 流浪者配置错误-“;必须指定一个方框。”;
这些箱子运转良好。然后我停了一个(当时唯一运行的一个),现在我无法让它们中的任何一个恢复Vagrant 流浪者配置错误-“;必须指定一个方框。”;,vagrant,vagrantfile,Vagrant,Vagrantfile,这些箱子运转良好。然后我停了一个(当时唯一运行的一个),现在我无法让它们中的任何一个恢复 运行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. 正在运行最
运行
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.
正在运行最新版本的Vagrant(1.7.4)
这是我的Vagrant文件的全部内容,包括注释(以防万一):
运行流浪状态的结果:
Current machine states:
php5dot3 poweroff (virtualbox)
php5dot6 poweroff (virtualbox)
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
运行流浪者全局状态的结果:
Current machine states:
php5dot3 poweroff (virtualbox)
php5dot6 poweroff (virtualbox)
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
“默认值”是我上周让多台机器工作之前在Vagrant文件中的单数框。(相关?)
运行流浪者框列表的结果:
scotch/box (virtualbox, 2.0)
smallhadroncollider/centos-6.5-lamp (virtualbox, 1.0.0)
非常感谢您的帮助。在您的机器定义中,您需要使用该机器的变量名,而不是
config
。试试这个:
在下面的文件中,我将config.vm
更改为php5dot3.vm
或php5dot6.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
我还在
php5dot6
框的定义中添加了autostart:false
,如果您愿意,可以删除该框。(这只是意味着默认情况下运行vagrant up
只会启动主程序。如果您在DigitalOcean中遇到此错误,您可能需要他们的插件:
vagrant plugin install vagrant-digitalocean
Installing the 'vagrant-digitalocean' plugin. This can take a few minutes...
Fetching: multipart-post-2.0.0.gem (100%)
Fetching: faraday-0.15.4.gem (100%)
Fetching: vagrant-digitalocean-0.9.3.gem (100%)
对于现在有此问题的人: 在尝试销毁之前,我已删除了我的vagrant文件。您需要从该进程的vagrant文件所在的正确目录中运行
vagrant destroy
命令
运行vagrant ssh config
并查看目录列
如果您像我一样删除了该文件,请执行以下操作:
vagrant init
然后
注意:如果您在运行这些命令时遇到权限问题,请使用
sudo
。我在这里创建了一个类似的问题:您以前是否运行过bash init.sh
?不,从未运行过任何与Vagrant相关的bash脚本。我也遇到过同样的问题,通过运行该行解决了。您的homestead.yaml
上指向ssh的路径文件也应该是正确的。这里没有使用宅地,只是流浪者。这似乎已经解决了我与流浪者之间长期存在的问题。非常感谢!希望你不必等待4个月问题才能得到解决!好的一面?问题解决了!另一面?…我怎么没弄明白…:/这解决了我在流浪者2.2.5上为DigitalOcean遇到的问题。谢谢!不客气,我的朋友。我很高兴我能为某人节省一些时间。如果这有帮助,请向上投票,以便其他人也能找到它。