Mac:Laravel宅基地 - 流浪汉错误

时间:2017-02-27 05:31:03

标签: php laravel vagrant virtualbox

我在laravel宅基地使用Vagrant和Virtual box作为虚拟主机。当我放弃流浪时,我得到以下错误。

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项目。如果我升级我的盒子,它会显示我旧版应用程序的错误。

任何人都可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分: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