2014-07-16 39 views
2

我有一個簡單的流浪盒,在構建教程的過程中正在構建。我在這裏建立了我的流浪文件。流浪外殼供應運行但失敗

# -*- 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 = "precise32" 
    config.vm.box_url = "http://files.vagrantup.com/precise32.box" 
    config.vm.provision :shell, :path => "bootstrap.sh" 

    #config.vm.network "forwarded_port", guest: 80, host: 8080 



end 

這似乎工作正常,正在等待一些其他配置,但我與供應有問題。

它發現Shell腳本沒有錯誤。它甚至建立了流浪箱。然而,當它完成當我什麼我安裝ssh來安裝安裝我得到這個錯誤

==> default: stdin: is not a tty 
==> default: bash: /tmp/vagrant-shell: /user/bin/env: bad interpreter: No such file or directory 
The following SSH command responded with a non-zero exit status. 
Vagrant assumes that this means the command failed! 

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell 

Stdout from the command: 



Stderr from the command: 

stdin: is not a tty 
bash: /tmp/vagrant-shell: /user/bin/env: bad interpreter: No such file or directory 

。當我通過命令在終端命令中運行bash腳本時,它可以工作。這是我的bash腳本。

#!/user/bin/env bash 

#install 
sudo apt-get update 
sudo apt-get install -y python-software-properties 
sudo add-apt-repository -y ppa:ondrej/php5 
sudo apt-get update 
sudo apt-get install -y wget php5 apache2 php5-mcrypt php5-curl git 
sudo apt-get update 

#apache onfig 
sudo a2enmod rewrite 

#Symlink for local development 
#remove the WWW for Apache 
sudo rm -rf /var/www 

#symlink for local directory ln -fs {PATH TO LOCAL PROJECT} /var/www 
sudo ln -fs /pathtolocaldirectory /var/www 

#Restart Apache 
sudo service apache2 restart 

回答

4

實際上錯誤信息很清楚:/user/bin/env不存在。

通過只需更換第一行中的bash腳本:

#!/usr/bin/env bash 
+2

這就是它我改變了環境爲 #!/ bin/bash 並且排序問題。感謝您的幫助! –

+0

@AaronBlakeley寫的是我在Windows 8.1下的解決方案 - 用#!/ bin/bash替換'#!/ usr/bin/env bash' –

0

你的/ tmp目錄或腳本本身缺少許可,這可能是這個問題,執行的根本原因。

爲了解決這個問題,嘗試

chmod 755 /tmp/ 

chmod +x /tmp/vagrant-shell 

,然後嘗試執行命令,它會工作的安全。