我想在我的Ubuntu上设置vagrant,当" vagrant up"时,它总是给我以下错误 语法错误,意外':',期待kEND config.vm.provision:shell,path:" vagrantprov.sh"
我检查了Vagrantfile,应该没关系,有谁能告诉我错误在哪里?感谢。
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
config.vm.provision :shell, path: "vagrantprov.sh"
end
答案 0 :(得分:4)
Ruby< 1.9?旧Ruby版本
需要旧式哈希语法样式config.vm.provision :shell, :path => "vagrantprov.sh"
答案 1 :(得分:3)
您运行的是哪个版本的Ruby?从1.9及更高版本开始支持命名的args语法(path: "..."
),也许你的Ruby版本较低?
(1.8)
1.8.7 :001 > puts "a", b: 1
SyntaxError: compile error
(irb):1: syntax error, unexpected ':', expecting $end
(1.9)
1.9.3p429 :001 > puts "a", b: 1
a
{:b=>1}
=> nil
答案 2 :(得分:0)
Ruby< 1.9:
:a => 1
Ruby> = 1.9:
a : 1