php 无法安装 Vagrant box Laravel Homestead

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31095225/
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-08-25 22:14:18  来源:igfitidea点击:

Can't install Vagrant box Laravel Homestead

phplaravelterminalvagranthomestead

提问by Alonso Arellano

I'm trying to install Laravel Homestead on Mac OS X following the official documentation instructions on here.

我正在尝试按照此处的官方文档说明在 Mac OS X 上安装 Laravel Homestead 。

I installed VirtualBox and Vagrant. Now I'm trying to add the Homestead box with the command vagrant box add laravel/homestead. After a while the download stops and I get an error. It doesn't let me restore the download so I have to delete the partial download file and start from zero. I've tried it many times.

我安装了 VirtualBox 和 Vagrant。现在我正在尝试使用命令添加 Homestead 框vagrant box add laravel/homestead。过了一会儿,下载停止,我收到一个错误。它不允许我恢复下载,所以我必须删除部分下载文件并从零开始。我已经试过很多次了。

I think my Internet connection has something to do since it's kinda slow and it's a large file.

我认为我的 Internet 连接有问题,因为它有点慢,而且文件很大。

Here's the complete code:

这是完整的代码:

$ vagrant box add laravel/homestead
==> box: Loading metadata for box 'laravel/homestead'
    box: URL: https://atlas.hashicorp.com/laravel/homestead
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) virtualbox
2) vmware_desktop

Enter your choice: 1
==> box: Adding box 'laravel/homestead' (v0.2.7) for provider: virtualbox
    box: Downloading: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.2.7/providers/virtualbox.box
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

transfer closed with 935392411 bytes remaining to read

After retrying:

重试后:

An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

HTTP server doesn't seem to support byte ranges. Cannot resume.

Any help is appreciated.

任何帮助表示赞赏。

回答by Chris Vogt

A.Go to .vagrant.d\tmp\and delete the partial download file, then try again.

A.前往.vagrant.d\tmp\并删除部分下载文件,然后重试。

B.If that fails, you could attempt downloading the file manually using a browser or other tool. Once downloaded, you can import it using vagrant box add laravel/homestead path/to/virtualbox.box.

B.如果失败,您可以尝试使用浏览器或其他工具手动下载文件。下载后,您可以使用vagrant box add laravel/homestead path/to/virtualbox.box.

(Edited:Adds second answer from comments below.)

编辑:从下面的评论中添加第二个答案。)

回答by Soroush

Try this:
rm ~/.vagrant.d/tmp/*or rm -R ~/.vagrant.d/tmp/*

试试这个:
rm ~/.vagrant.d/tmp/*rm -R ~/.vagrant.d/tmp/*

Then vagrant upagain.

然后vagrant up再说。

回答by Juned Ansari

just goto C:\Users\YourUSERNAME\ .vagrant.d\tmp

and delete all the files then again type following command

vagrant box add laravel/homestead

Thats it Enjoy......

只需转到 C:\Users\YourUSERNAME\ .vagrant.d\tmp

并删除所有文件,然后再次键入以下命令

vagrant box 添加 laravel/homestead

那就是享受......

回答by cody

Try:

尝试:

vagrant box add laravel/homestead -c

回答by sketchthat

If you're using Vagrant V2 then you can use the --cleanflag when adding a box.

如果您使用的是 Vagrant V2,那么您可以--clean在添加框时使用该标志。

vagrant box add laravel/homestead --clean

--clean- If given, Vagrant will remove any old temporary files from prior downloads of the same URL. This is useful if you don't want Vagrant to resume a download from a previous point, perhaps because the contents changed.

--clean- 如果给定,Vagrant 将从先前下载的相同 URL 中删除任何旧的临时文件。如果您不希望 Vagrant 从前一点恢复下载,这很有用,这可能是因为内容已更改。

Vagrant Documentation

流浪文档

回答by user3123372

type

类型

cd ~

then type

然后输入

rm -rf .vagrant.d

That should get it done .

那应该可以搞定。

回答by hmmm

I also got the same problem and I just went to

我也遇到了同样的问题,我刚去了

Home --> .vagrant.d -->tmp

主页 --> .vagrant.d -->tmp

Now here one zip file will be there, please delete that one and your done.

现在这里将有一个 zip 文件,请删除该文件并完成。

回答by Rennan Felipe

I solve this editing the .jsonfile in: ~/.vagrant.d/data/machine-indexDelete the value of key machineslike "machines": {...}to "machines":{}

我解决了这个编辑.json文件的问题:~/.vagrant.d/data/machine-indexDelete the value of key machineslike "machines": {...}to"machines":{}

回答by A Jamal

To download a file you have to add version and provider in the URL. For example for downloading precise64 First you need its URL which is https://atlas.hashicorp.com/ubuntu/boxes/trusty64

要下载文件,您必须在 URL 中添加版本和提供程序。例如下载 precision64 首先你需要它的 URL 是https://atlas.hashicorp.com/ubuntu/boxes/trusty64

then you have to add version and provider afterwards, for our example the download URL would be.

然后您必须在之后添加版本和提供程序,对于我们的示例,下载 URL 将是。

https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box

https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box

Then you have to add it locally from your vagrant file.

然后你必须从你的流浪文件本地添加它。

To add it locally to vagrant file use the following command

要将其本地添加到 vagrant 文件,请使用以下命令

vagrant box add foo-box /path/to/vagrant-box.box
vagrant init foo-box
vagrant up

This will create the vagrantfile and you can configure the vagrant file.

这将创建 vagrantfile,您可以配置 vagrant 文件。

回答by Zed Pi

I was simply resuming the process a few times before it was finally done. I think that the main problem is with the internet connection, it falters here at my home. The cleanest way certainly would be what others already suggested plus moving somewhere with a stable connection.

在它最终完成之前,我只是简单地恢复了这个过程几次。我认为主要的问题是互联网连接,它在我家这里不稳定。最干净的方法当然是其他人已经建议的方法,再加上移动到具有稳定连接的地方。