2017-03-06 6 views
0

私の設定は以下の通りですし、ボックスが正常に動作しました:ベイグラントコンフィグエラー - 「ボックスを指定しなければなりません。」


# -*- mode: ruby -*- 
# vi: set ft=ruby : 

# All Vagrant configuration is done below. The "2" in Vagrant.configure 
# configures the configuration version (we support older styles for 
# backwards compatibility). Please don't change it unless you know what 
# you're doing. 
Vagrant.configure("2") do |config| 

    (1..4).each do |i| 

    config.vm.define "node#{i}", autostart:true do |node| 

     config.vm.box = "ubuntu/trusty64" 
     config.vm.hostname="node#{i}" 
     config.vm.network "private_network", ip: "192.168.59.#{i}" 
     config.vm.synced_folder "~/Documents/csunp/unp", "/vagrant/unp" 
     config.vm.provider "virtualbox" do |v| 
      v.name = "node#{i}" 
      v.memory = 512 
      v.cpus = 1 
     end 
    end 
    end 
end 

しかし、私は自分のコンピュータの電源を切った後、私は」することができますもう戻らない。それと間違って何

Bringing machine 'node1' up with 'virtualbox' provider... 
Bringing machine 'node2' up with 'virtualbox' provider... 
Bringing machine 'node3' up with 'virtualbox' provider... 
Bringing machine 'node4' up with 'virtualbox' provider... 
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を実行して、私は以下のエラーを得ましたか?前もって感謝します。

答えて

1

あなたVagrantfileは非常によく書かれていない、あなたはノード変数と4つのインスタンスを作成するためにループを作成していますが、簡単な維持したい場合は、まだconfig.vm

を使用して、

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

# All Vagrant configuration is done below. The "2" in Vagrant.configure 
# configures the configuration version (we support older styles for 
# backwards compatibility). Please don't change it unless you know what 
# you're doing. 
Vagrant.configure("2") do |config| 

    (1..4).each do |i| 

    config.vm.define "node#{i}", autostart:true do |node| 

     node.vm.box = "ubuntu/trusty64" 
     node.vm.hostname="node#{i}" 
     node.vm.network "private_network", ip: "192.168.59.#{i}" 
     node.vm.synced_folder "~/Documents/csunp/unp", "/vagrant/unp" 
     node.vm.provider "virtualbox" do |v| 
      v.name = "node#{i}" 
      v.memory = 512 
      v.cpus = 1 
     end 
    end 
    end 
end 
への変更が口ずさん

4つのすべてのVMに同じボックスを使用している場合は、

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

# All Vagrant configuration is done below. The "2" in Vagrant.configure 
# configures the configuration version (we support older styles for 
# backwards compatibility). Please don't change it unless you know what 
# you're doing. 
Vagrant.configure("2") do |config| 

    config.vm.box = "ubuntu/trusty64" 
    config.vm.synced_folder "~/Documents/csunp/unp", "/vagrant/unp" 

    (1..4).each do |i| 

    config.vm.define "node#{i}", autostart:true do |node| 

     node.vm.hostname="node#{i}" 
     node.vm.network "private_network", ip: "192.168.59.#{i}" 
     node.vm.provider "virtualbox" do |v| 
      v.name = "node#{i}" 
      v.memory = 512 
      v.cpus = 1 
     end 
    end 
    end 
end 
と書くことができます
関連する問題