【问题标题】:No Input File Specified Laravel Homestead没有指定输入文件 Laravel Homestead
【发布时间】:2015-06-01 15:32:23
【问题描述】:

我是 laravel 新手,我仍然对 Homestead.yaml 的配置感到困惑

我的 laravel 项目位于 C:/wamp/www/laravel 并在 Homestead.yaml 中配置如下

folders:
- map: /wamp/www/laravel
  to: /home/Vagrant/Code

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

databases:
- homestead

variables:
- key: APP_ENV
  value: local

这个配置有什么问题?还要我手动创建

/home/Vagrant/Code 

/home/Vagrant/Code/Laravel/public?

如果是,在哪个 windows 目录中?我对 /home 目录感到困惑,因为我使用的是 windows 8 机器。

【问题讨论】:

  • 你可以通过 homestead ssh 访问你的 homestead 实例吗?您不必创建 /home/Vagrant/Code,它应该为您创建它。您可以通过执行 homestead ssh 来验证这一点,并查看其中的内容。
  • @Jeremy.在 Homestead 文件夹中运行 homestead ssh 会出现此错误“警告:需要(C:\Users\me\Homestead/../../autoload.php):无法打开流:第 13 行的 C:\Users\me\Homestead\homestead 中没有这样的文件或目录”。但是如果我在 Homestead 文件夹中运行 vagrant ssh,我可以 ssh。这是否意味着我必须在 Homestead 文件夹中安装 laravel?最初我安装了laravel 在我的 C:/wamp/www/laravel 文件夹中
  • 如果你使用宅基地,是的,你可以从你的 vagrant Box 运行 laravel 应用

标签: laravel-5 homestead


【解决方案1】:

是啊,宅基地的配置也让我很困惑。我可以推荐你购买电子书Easy Laravel 5 by Jason Gilmore,或read the homestead chapter for free online right here。正是他关于宅基地配置的章节帮助我理解了如何去做。这本电子书还包含许多其他关于 Laravel 5 开发的好东西,并且经常更新。

更新:The Laravel 5 Beauty blog 也有一个非常容易理解的关于如何为 Laravel 5.1 设置宅基地的指南。在 Windows、Linux 和 Mac 上都可以。

也就是说,我会在这里尝试回答您的问题。第 5 步是如何设置宅基地配置。不,您不必自己创建 vagrant/Code 文件夹。这是您提供的路径的别名。

0. Install Composer 如果你还没有。

还将 composer bin 添加到您的路径中:

LINK TO BIGGER VERSION OF PICTURE BELOW


1.确保您已下载最新版本的VagrantOracle VirtualBox


2.添加laravel框:$ vagrant box add laravel/homestead


3. 安装 Homestead CLI 工具:$ composer global require "laravel/homestead=~2.0"


4. 创建您的 .homestead 文件夹:

$ cd -> 转到您的用户文件夹

$ homestead init -> 创建 .homestead 文件夹

这里还要注意,您需要拥有包含 id_rsa 和 id_rsa.pub 文件的 .ssh 文件夹。如果您的用户文件夹中没有它,follow this guide to get it.


5. 编辑您的 Homestead.yaml 文件。我将在这里使用我的设置作为示例:

LINK TO BIGGER VERSION OF PICTURE BELOW


6. 转到C:\Windows\System32\drivers\etc\ 并编辑主机文件。它会警告您并要求管理员权限。只需使用管理员控制打开它。

使用您在 homestead.yaml 文件中设置的网址编辑您的主机文件:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

192.168.10.10   phpmyadmin.local
192.168.10.10   lara.local
192.168.10.10   todoparrot.local

7. 运行以下 CLI 命令来配置 vagrant。老实说,我不太确定这是做什么的,但它有点重启 vagrant 所以它与你的 homestead.yaml 和主机配置是最新的。

$ vagrant global-status -> 注意开头出现的小数字。我的是 2a6e97d

$ vagrant provision 2a6e97d


8.运行$ homestead up,让它完成运行并转到你的url,在我的例子中是lara.local。这是我的屏幕:


我希望这不会太令人困惑。第一次建立宅基地真的很痛苦,但是当你“了解”它是如何工作的时候,它就会变成纯粹的幸福。

如果有什么不清楚的地方,请写评论,我会尽力帮忙的:)

【讨论】:

  • 我不知道我可以通过 ID 进行配置,感谢该命令。 +1
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-06-03
  • 2014-08-08
  • 2018-03-12
  • 2015-09-01
  • 2017-05-22
  • 1970-01-01
  • 2020-02-03
相关资源
最近更新 更多