【问题标题】:Problems in configuring Homestead.yaml in Laravel 5在 Laravel 5 中配置 Homestead.yaml 的问题
【发布时间】:2014-11-01 06:46:58
【问题描述】:

我是 Laravel 的新手,我将为我的应用设置虚拟机。我很好地关注文档,我几乎完成了配置。我被困在这里了。

我有 Windows 8,我的 Homestead.yaml 文件如下所示:

authorize: E:/laravel_projects/Homestead/keys.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: E:/laravel_projects
      to: E:/vagrant/laravel_projects

sites:
    - map: learn.app
      to: E:/vagrant/laravel_projects/myfirstapp/public

variables:
    - key: APP_ENV
      value: local

当我在 cmd 中运行 Vagrant 时,错误是这样的。

E:/laravel_projects/Homestead/scripts/homestead.rb:26:in `read': No such file or directory - E:/laravel_projects/Homestead/keys.pub (Errno::ENOENT)
    from E:/laravel_projects/Homestead/scripts/homestead.rb:26:in `block in configure'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/kernel_v2/config/vm_provisioner.rb:72:in `call'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/kernel_v2/config/vm_provisioner.rb:72:in `add_config'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/kernel_v2/config/vm.rb:285:in `provision'
    from E:/laravel_projects/Homestead/scripts/homestead.rb:24:in `configure'
    from E:/laravel_projects/Homestead/Vagrantfile:9:in `block in <top (required)>'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/v2/loader.rb:37:in `call'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/v2/loader.rb:37:in `load'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:103:in `block (2 levels) in load'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:97:in `each'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:97:in `block in load'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:94:in `each'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/config/loader.rb:94:in `load'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/vagrantfile.rb:28:in `initialize'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:614:in `new'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:614:in `vagrantfile'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:399:in `host'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:198:in `block in action_runner'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:33:in `call'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:33:in `run'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:386:in `hook'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:596:in `unload'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:177:in `ensure in <main>'
    from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:177:in `<main>'

我的项目路径是 E:/laravel_projects。

【问题讨论】:

  • 控制台错误最好以文本形式提供,而不是屏幕截图 - 人们更容易阅读。你会换那个吗?

标签: php laravel-5


【解决方案1】:

应该是这样的:

folders:
    - map: E:/laravel_projects
      to: /home/vagrant/laravel_projects
  - map: E:/laravel_projects/myfirstapp
      to: /home/vagrant/laravel_projects/myfirstapp

sites:
    - map: learn.app
      to: /home/vagrant/laravel_projects/myfirstapp/public

你的 linux 虚拟机没有 E 盘。

【讨论】:

  • 感谢肉汁.. 但帮助不大。仍然收到一堆错误。不知道我错过了什么。关键部分有什么要改变的吗??
  • 另外,请参阅更新的答案。您需要在文件夹中包含myfirstapp。最后,根据错误消息,您的 keys.pub 文件不在 E:/laravel_projects/Homestead/keys.pub 中。
【解决方案2】:

查看错误的第一行:

E:/laravel_projects/Homestead/scripts/homestead.rb:26:in `read': 没有这样的文件或目录 - E:/laravel_projects/Homestead/keys.pub (Errno::ENOENT)

显然钥匙不在那里。确保您已生成 SSH 密钥并指定了正确的路径。

另外,在您的 Homestead.yaml 中:

keys:
    - ~/.ssh/id_rsa

这是您的私钥的路径,尽管它是 *nix 路径。您需要将此设置为您在 Windows 系统上生成的私钥的路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-26
    • 2019-04-16
    • 2015-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多