2014-07-16 41 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 

,然后尝试执行命令,它会工作的安全。