Vagrant Config Error - “A box must be specified.”

前端 未结 3 494
Happy的楠姐
Happy的楠姐 2021-02-08 00:59

The boxes were working fine. Then I halted one (the only one running at the time) and now I can\'t get either of them back up.


Running vagrant up [name]

3条回答
  •  暖寄归人
    2021-02-08 01:35

    Inside of your machine definitions, you need to use the variable name of that machine, instead of config. Try this out:

    In the file below, I've changed config.vm to either php5dot3.vm or 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
    

    I also added autostart:false to the definition of your php5dot6 box, which you can remove if you wish. (It just means that running vagrant up will only start the primary by default.

提交回复
热议问题