2017-02-27 162 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)完成 –