【问题标题】:error running vagrant up with Laravel homestead使用 Laravel homestead 运行 vagrant 时出错
【发布时间】:2015-01-25 21:24:10
【问题描述】:

我已经成功使用宅基地大约一个小时了,但是当我使用vagrant suspend 暂停我的虚拟机并尝试使用vagrant up 再次启动它时,我收到了这个错误:

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

shell provisioner:
* Shell provisioner `args` must be a string or array.

这是什么意思?流浪者文档说

shell 配置器有多种选择。内联或路径之一是 必填

我需要在某处传递一些参数吗?我做错了什么?

提前致谢

这是我的流浪文件:

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION = "2"

homesteadYamlPath = File.expand_path("~/.homestead/Homestead.yaml")
afterScriptPath = File.expand_path("~/.homestead/after.sh")
aliasesPath = File.expand_path("~/.homestead/aliases")

require_relative 'scripts/homestead.rb'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    if File.exists? aliasesPath then
        config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
    end

    Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))

    if File.exists? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath
    end
end

【问题讨论】:

  • 将内容粘贴到Vagrantfile
  • 对不起,您指的是什么内容?我是这个话题的大菜鸟:p
  • 当你启动一个vagrant实例时,你需要一个默认或自定义的Vagrantfie文件,把内容粘贴到这里。如果没有,您需要运行vagrant init 来生成它。
  • 我已将我的 vagrantfile 添加到我的问题中。我已经运行了 vagrant init,当我运行 vagrant box list 时我有两个宅基地框

标签: laravel vagrant homestead


【解决方案1】:

如果这是宅基地 2,您需要使用 homestead uphomestead suspend 等。

homestead list

【讨论】:

    【解决方案2】:

    这是我的~/homestead/.Homestead.yaml 文件,它包含两个应用程序的配置,一个启用了 HHVM,一个禁用了 HHVM(默认在宅基地)。

    Homestead 会在运行homestead up 时在 MySQL 和 PostgreSQL 服务器中为您创建数据库。

    ---
    ip: "192.168.10.10"
    memory: 2048
    cpus: 1
    
    authorize: ~/.ssh/id_rsa.pub
    
    keys:
        - ~/.ssh/id_rsa
    
    folders:
        - map: ~/Projects
          to: /home/vagrant/Projects
    
    sites:
        - map: jobs.app
          to: /home/vagrant/Projects/jobs/public
        - map: messages.app
          to: /home/vagrant/Projects/messages/web
          hhvm: true
    
    databases:
        - jobs
        - messages
    
    variables:
        - key: APP_ENV
          value: local
    

    您现在可以运行: $homestead up

    然后: $homestead ssh

    然后运行 ​​byobu(用于 tmux): $byobu

    并 cd 进入项目: $cd Projects/jobs

    并运行作曲家: $composer update

    【讨论】:

      猜你喜欢
      • 2016-07-06
      • 1970-01-01
      • 2018-05-26
      • 2015-02-27
      • 2017-05-05
      • 1970-01-01
      • 2020-02-22
      • 1970-01-01
      • 2017-04-25
      相关资源
      最近更新 更多