Laravel homestead Can't Preform Vagrant Up Error Constraints: >= 13.0.0, < 14.0.0

132 Views Asked by At

This is the vagrantfile

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

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
customizationScriptPath = confDir + "/user-customizations.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "laravel/homestead"

  if File.exist? aliasesPath
    config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
    config.vm.provision "handle_aliases", type: "shell" do |s|
      s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
    end
  end

  if File.exist? homesteadYamlPath
    settings = YAML::load(File.read(homesteadYamlPath))
  elsif File.exist? homesteadJsonPath
    settings = JSON::parse(File.read(homesteadJsonPath))
  else
    abort "Homestead settings file not found in #{confDir}"
  end

  Homestead.configure(config, settings)

  if File.exist? afterScriptPath
    config.vm.provision "Run after.sh", type: "shell", path: afterScriptPath, privileged: false, keep_color: true
  end

  if File.exist? customizationScriptPath
    config.vm.provision "Run customize script", type: "shell", path: customizationScriptPath, privileged: false, keep_color: true
  end

  if Vagrant.has_plugin?('vagrant-hostsupdater')
    config.hostsupdater.remove_on_suspend = false
    config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
  elsif Vagrant.has_plugin?('vagrant-hostmanager')
    config.hostmanager.enabled = true
    config.hostmanager.manage_host = true
    config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
  elsif Vagrant.has_plugin?('vagrant-goodhosts')
    config.goodhosts.aliases = settings['sites'].map { |site| site['map'] }
  end

  if Vagrant.has_plugin?('vagrant-notify-forwarder')
    config.notify_forwarder.enable = true
  end
end

**I tried Starting Vagrant in the homestead directory but when i start it gives error **

vagrant up Bringing machine 'homestead' up with 'virtualbox' provider... ==> homestead: Box 'laravel/homestead' could not be found. Attempting to find and install... homestead: Box Provider: virtualbox homestead: Box Version: >= 13.0.0, < 14.0.0 ==> homestead: Loading metadata for box 'laravel/homestead' homestead: URL: https://vagrantcloud.com/api/v2/vagrant/laravel/homestead The box you're attempting to add has no available version that matches the constraints you requested. Please double-check your settings. Also verify that if you specified version constraints, that the provider you wish to use is available for these constraints.

Box: laravel/homestead Address: https://vagrantcloud.com/api/v2/vagrant/laravel/homestead Constraints: >= 13.0.0, < 14.0.0 Available versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.3.0, 0.3.3, 0.4.0, 0.4.1, 0.4.2, 0.4.4, 0.5.0, 0.6.0, 0.6.1, 1.0.0, 1.0.1, 1.1.0, 2.0.0, 2.1.0, 2.2.0, 3.0.0, 3.1.0, 4.0.0, 5.0.1, 5.1.0, 5.2.0, 6.0.0, 6.1.0, 6.2.0, 6.3.0, 6.4.0, 7.0.0, 7.1.0, 7.2.1, 8.0.0.pre.alpha1, 8.0.0.pre.alpha2, 8.0.0.pre.alpha3, 8.0.0.pre.alpha4, 8.0.0.pre.beta, 8.0.0, 8.0.1, 8.1.0, 8.2.0, 8.2.1, 9.0.0, 9.0.1, 9.1.0, 9.1.1, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.5.1, 9.6.0, 9.6.1, 9.7.2, 10.0.0, 10.1.0, 10.1.1, 11.0.0, 11.1.0, 11.3.0, 11.4.0, 11.5.0, 12.0.0, 12.1.0, 12.2.0, 13.0.0

1

There are 1 best solutions below

0
elemes On

The error you are experiencing shows that there are no version of 'laravel/homestead' that meets the version constraints you specified . you can specify the vagrant version in you vagrant file like this

i added this :

config.vm.box = "laravel/homestead" config.vm.box_version = "13.0.0" # Specify the box version here

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

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
customizationScriptPath = confDir + "/user-customizations.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "laravel/homestead"
  config.vm.box_version = "13.0.0"  # Specify the box version here

  if File.exist? aliasesPath
    config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
    config.vm.provision "handle_aliases", type: "shell" do |s|
      s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
    end
  end

  if File.exist? homesteadYamlPath
    settings = YAML::load(File.read(homesteadYamlPath))
  elsif File.exist? homesteadJsonPath
    settings = JSON::parse(File.read(homesteadJsonPath))
  else
    abort "Homestead settings file not found in #{confDir}"
  end

  Homestead.configure(config, settings)

  if File.exist? afterScriptPath
    config.vm.provision "Run after.sh", type: "shell", path: afterScriptPath, privileged: false, keep_color: true
  end

  if File.exist? customizationScriptPath
    config.vm.provision "Run customize script", type: "shell", path: customizationScriptPath, privileged: false, keep_color: true
  end

  if Vagrant.has_plugin?('vagrant-hostsupdater')
    config.hostsupdater.remove_on_suspend = false
    config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
  elsif Vagrant.has_plugin?('vagrant-hostmanager')
    config.hostmanager.enabled = true
    config.hostmanager.manage_host = true
    config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
  elsif Vagrant.has_plugin?('vagrant-goodhosts')
    config.goodhosts.aliases = settings['sites'].map { |site| site['map'] }
  end

  if Vagrant.has_plugin?('vagrant-notify-forwarder')
    config.notify_forwarder.enable = true
  end
end

for more version info check available versions here https://app.vagrantup.com/laravel/boxes/homestead