2014-10-24 2 views
1

우분투에 방랑제를 설치하고 싶을 때 항상 다음과 같은 오류가납니다. 예상치 못한 ':', 예상 kEND config.vm. 조항 : 셸, 경로 : "vagrantprov.sh"루비 예상치 못한 ':', kEND를 기대합니다

내가 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 

답변

3

실행중인 Ruby의 버전은 무엇입니까? 명명 된 args 구문 (path: "...")은 1.9 이상에서 지원됩니다. 아마도 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 
+0

기본 루비는 1.8.7입니다. 이제 1.9.1로 업데이트했습니다. 덕분에 작동합니다! –

4

루비 < 1.9? 구식 Ruby 버전에는 구식의 해시 구문 스타일이 필요합니다.

+0

기본 루비는 1.8.7입니다. 이제 1.9.1로 업데이트했습니다. 덕분에 작동합니다! –

0

루비 < 1.9 :

:a => 1 

루비> = 1.9 :

a : 1