2017-02-27 80 views
0

我在laravel宅基地使用虛擬主機的Vagrant和Virtual box。當我讓流浪漢出現時,我得到了以下錯誤。Mac:Laravel宅基地 - vagrant up錯誤

Bringing machine '***********' up with 'virtualbox' provider... 
There are errors in the configuration of this machine. Please fix 
the following errors and try again: 

shell provisioner: 
* The following settings shouldn't exist: name 
* The following settings shouldn't exist: name 
* The following settings shouldn't exist: name 
* The following settings shouldn't exist: name 
* The following settings shouldn't exist: name 
* The following settings shouldn't exist: name 

這是我的無業遊民文件:

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

require 'json' 
require 'yaml' 

VAGRANTFILE_API_VERSION ||= "2" 
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__)) 

homesteadYamlPath = "Homestead.yaml" 
homesteadJsonPath = "Homestead.json" 
afterScriptPath = "after.sh" 
aliasesPath = "aliases" 

require File.expand_path(confDir + '/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: "/tmp/bash_aliases" 
     config.vm.provision "shell" do |s| 
      s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases" 
     end 
    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 

其節目需要更高版本的無業遊民,所以我只是吩咐線。

這是我Homestead.yaml

--- 
ip: "192.168.10.10" 
memory: 2048 
cpus: 1 
hostname: *******" 
name: *******" 
provider: virtualbox 

authorize: ~/.ssh/id_rsa.pub 

keys: 
    - ~/.ssh/id_rsa 

folders: 
    - map: "/Users/*******" 
     to: "/home/vagrant//*******"" 

sites: 
    - map: *******.app 
     to: "/home/vagrant/*******/public" 

databases: 
    - ******* 

# blackfire: 
#  - id: foo 
#  token: bar 
#  client-id: foo 
#  client-token: bar 

# ports: 
#  - send: 50000 
#  to: 5000 
#  - send: 7777 
#  to: 777 
#  protocol: udp 

我知道通過升級我的虛擬框和流浪者版本,它會解決這個問題。但是我現在的虛擬盒子裏已經失去了現有的laravel項目。如果我升級我的盒子,它顯示我的舊應用程序的錯誤。

任何人都可以幫助我如何克服這一點?

回答

0

在你的homestead.yaml文件中,似乎名爲'name'的設置是給你的悲傷。我會嘗試評論這一行,看看是否有幫助。

ip: "192.168.10.10" 
memory: 2048 
cpus: 1 
hostname: *******" 
# name: *******" <----- THIS LINE HERE 
provider: virtualbox 

如果您嘗試使用舊版本的宅基地,我會考慮使用「版本」設置。

在這裏看到: https://laravel.com/docs/5.4/homestead#old-versions

編輯:樣品Homestead.yaml

ip: "192.168.10.10" 
memory: 2048 
cpus: 1 
provider: virtualbox 

authorize: ~/.ssh/id_rsa.pub 

keys: 
    - ~/.ssh/id_rsa 

folders: 
    - map: ~/Code 
     to: /home/vagrant/Code 

sites: 
    - map: homestead.app 
     to: /home/vagrant/Code/Laravel/public 

databases: 
    - homestead 
+0

大。希望我們靠近。但現在我得到了默認的機器名稱和以下錯誤:將機器「homestead-7」與'virtualbox'提供商聯繫起來...... 本機的配置存在錯誤。請修正 下列錯誤,然後再試一次: 外殼供應方: *下面的設置應該不存在:命名 *下面的設置應該不存在:命名 *下面的設置應該不存在:命名 *以下設置不應該存在:名稱 *以下設置不應該存在:名稱 *以下設置不應該存在:名稱 – Muthu17

+0

看起來像完全相同的錯誤。嘗試註釋掉主機名行。我還會發佈一個示例Homestead.yaml文件,我有這個工程。我不相信你需要'名字'或'主機名'。所有的主機名應該通過一個單獨的文件(/ etc/hosts)完成 –