laravel 需要 Vagrant 环境或目标机器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34745295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 13:02:12  来源:igfitidea点击:

A Vagrant environment or target machine is required

laravelvagrantvagrantfilehomestead

提问by Радослав Ангелов

I am trying to set up homestead. I have tried to add new custom domain but I forgot that I have to run the command vagrant provision and I got an error, so I have decided to uninstall Vagrant VirtualBox and start from scratch but I have realy messed the things up.

我正在尝试建立家园。我试图添加新的自定义域,但我忘记了我必须运行命令 vagrant provision 并且出现错误,所以我决定卸载 Vagrant VirtualBox 并从头开始,但我真的把事情搞砸了。

Now I have installed VirtualBox, Vagrant. I have cloned the repository of homestead on my home directory. I filled the Homestead.yaml but when I start with vagrant up I get this error

现在我已经安装了 VirtualBox,Vagrant。我已经在我的主目录中克隆了 homestead 的存储库。我填写了 Homestead.yaml 但是当我从 vagrant up 开始时我收到这个错误

A Vagrant environment or target machine is required to run this command. Run vagrant initto create a new Vagrant environment. Or, get an ID of a target machine from vagrant global-statusto run this command on. A final option is to change to a directory with a Vagrantfile and to try again. Also I have tried to require homestead through composer but I`am still getting the same error.

运行此命令需要 Vagrant 环境或目标机器。运行vagrant init以创建新的 Vagrant 环境。或者,获取目标机器的 IDvagrant global-status以运行此命令。最后一个选择是切换到包含 Vagrantfile 的目录并重试。我也试图通过作曲家要求宅基地,但我仍然遇到同样的错误。

When I try with vagrant init a new box is created and when I start vagrant up I am not in the homestead box but in the one that I last created.

当我尝试使用 vagrant init 时,会创建一个新盒子,当我开始 vagrant up 时,我不在宅基地盒子中,而是在我上次创建的盒子中。

I am really confused and I don`t know what I am missing. Any help will be appreciated.

我真的很困惑,我不知道我错过了什么。任何帮助将不胜感激。

edit.

编辑。

Also when I try with homestead up, the virtual machine is running and I am able to connect through ssh but when I type custom domains I get "No input file specified."

此外,当我尝试使用 homestead 时,虚拟机正在运行,我能够通过 ssh 进行连接,但是当我输入自定义域时,我得到“未指定输入文件”。

update:

更新:

In the ~/.homestead directory I have executed vagrant init laravel/homesteadand now I can start the the machine and to connect through ssh but I can`t go to a registered custom domain - the page is not available.

在 ~/.homestead 目录中我已经执行vagrant init laravel/homestead,现在我可以启动机器并通过 ssh 连接,但我不能去注册的自定义域 - 该页面不可用。

Update 2:

更新 2:

Also I just checked and on the homestead server my Code folder is empty. In the Homestead.yamlfile I have folders - map: ~/Code to: /home/vagrant/Code

另外我刚刚检查了一下,在宅基地服务器上我的代码文件夹是空的。在Homestead.yaml文件中我有文件夹 - map: ~/Code to: /home/vagrant/Code

All my projects are there in the local folder and I have no idea why they are not on vagrant.

我所有的项目都在本地文件夹中,我不知道为什么它们不在 vagrant 上。

回答by S1awek

99% you're in wrong directory. Make sure that the directory includes Vagrantfile.

99% 你在错误的目录中。确保该目录包含Vagrantfile

回答by Jeff

Can you run vagrant global-statusto see if there is already a Vagrant server running? Then you can use vagrant up [server-id]to get into the existing one.

你可以运行vagrant global-status看看是否已经有一个 Vagrant 服务器在运行?然后你可以使用vagrant up [server-id]进入现有的。

回答by Frederic Henri

Also when I try with homestead up, the virtual machine is running and I am able to connect through ssh but when I type custom domains I get "No input file specified."

此外,当我尝试使用 homestead 时,虚拟机正在运行,我能够通过 ssh 进行连接,但是当我输入自定义域时,我得到“未指定输入文件”。

Did you add your custom domains to your Homestead.yamlfile in the sites section and run `vagrant provision

您是否将自定义域添加到Homestead.yaml站点部分的文件中并运行了 `vagrant provision

回答by aye decoder

As someone said earlier, you could be in the wrong directory. Actually going to the right directory containing the 'Vagrantfile' was all that solved my problem.

正如之前有人所说,您可能在错误的目录中。实际上转到包含“Vagrantfile”的正确目录就解决了我的问题。