0

on installing fresh vagrant instance, I am getting this error while using vagrant up. Here is the error

Vagrant failed to initialize at a very early stage: There is a syntax error in the following Vagrantfile. The syntax error message is reproduced below for convenience: /mnt/c/Users/bilal/Homestead/scripts/homestead.rb:141: syntax error, unexpected tPOW ...ype: folder["type"] ||= nil, **options ... ^ /mnt/c/Users/bilal/Homestead/scripts/homestead.rb:157: syntax error, unexpected keyword_do_block, expecting keyword_end settings["sites"].each do |site| ^ /mnt/c/Users/bilal/Homestead/scripts/homestead.rb:207: syntax error, unexpected keyword_do_block, expecting keyword_end settings["databases"].each do |db| ^ /mnt/c/Users/bilal/Homestead/scripts/homestead.rb:208: syntax error, unexpected tSTRING_BEG, expecting keyword_end config.vm.provision "shell" do |s| ^ /mnt/c/Users/bilal/Homestead/scripts/homestead.rb:208: syntax error, unexpected keyword_do_block, expecting keyword_end config.vm.provision "shell" do |s| ^ /mnt/c/Users/bilal/Homestead/scripts/homestead.rb:220: syntax error, unexpected keyword_end, expecting $end 

Here is my VagrantFile content

# -*- mode: ruby -*- # vi: set ft=ruby : require 'json' require 'yaml' VAGRANTFILE_API_VERSION ||= "2" confDir = $confDir ||= File.expand_path("~/.homestead") homesteadYamlPath = confDir + "/Homestead.yaml" homesteadJsonPath = confDir + "/Homestead.json" afterScriptPath = confDir + "/after.sh" aliasesPath = confDir + "/aliases" require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb') Vagrant.require_version '>= 1.8.4' Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| if File.exist? aliasesPath then config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases" end if File.exist? homesteadYamlPath then settings = YAML::load(File.read(homesteadYamlPath)) elsif File.exist? homesteadJsonPath then settings = JSON.parse(File.read(homesteadJsonPath)) end Homestead.configure(config, settings) if File.exist? afterScriptPath then config.vm.provision "shell", path: afterScriptPath, privileged: false end if defined? VagrantPlugins::HostsUpdater config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] } end end 

============================================================

And there is the YAML file

--- ip: "192.168.10.10" memory: 2048 cpus: 1 provider: virtualbox authorize: ~/.ssh/id_rsa.pub keys: - ~/.ssh/id_rsa folders: - map: ~/Code to: /mnt/e/XAMPP/htdocs sites: - map: homestead.app to: /mnt/e/XAMPP/htdocs/cap/web databases: - homestead 
6
  • 1
    Can you show us your Vagrantfile ? Commented Oct 14, 2016 at 6:27
  • include also your yaml file. Commented Oct 14, 2016 at 6:29
  • Added both files content in question. Commented Oct 14, 2016 at 6:34
  • @FrédéricHenri I added both files in question. Commented Oct 14, 2016 at 6:47
  • weird ! how did you install vagrant ? vagrant should ship with ruby 2.0+ but looks like it runs with an older version of ruby which does not support the double splat operator Commented Oct 14, 2016 at 7:01

1 Answer 1

1

Solved that issue by upgrading Vagrant to 1.8.4.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.