2015-06-28 103 views
37

我想在Mac OS X上安裝Laravel Homestead,關於here的官方文檔說明。不能安裝Vagrant框Laravel Homestead

我安裝了VirtualBox和Vagrant。現在我試圖用命令vagrant box add laravel/homestead添加Homestead框。一段時間後下載停止,我得到一個錯誤。它不會讓我恢復下載,所以我必須刪除部分下載文件並從零開始。我已經嘗試了很多次。

我認爲我的互聯網連接有一些事情要做,因爲它有點慢,它是一個大文件。

下面是完整的代碼:

$ 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 

重試後:

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. 

任何幫助表示讚賞。

+0

您是否連接不良? – ceejayoz

回答

67

A.轉到.vagrant.d\tmp\並刪除部分下載文件,然後重試。

B.如果失敗,您可以嘗試使用瀏覽器或其他工具手動下載文件。下載後,您可以使用vagrant box add laravel/homestead path/to/virtualbox.box導入它。

然後vagrant up再次
rm ~/.vagrant.d/tmp/*rm -R ~/.vagrant.d/tmp/*

:(編輯:把從下面的評論第二個答案。)

+0

我已經做了很多次了。你知道如果還有其他選擇嗎? –

+4

嗯,你可以嘗試使用瀏覽器或其他工具手動下載[文件](https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.2.7/providers/virtualbox.box)。下載完成後,您可以使用'vagrant box add laravel/homestead path/to/virtualbox.box'來導入它。 –

+1

對我來說,它只能像Vogt在評論中所建議的那樣。 – user2094178

44

試試這個。

+1

這值得更多upvotes – xhulio

+1

爲我工作。謝謝。 –

+1

這工作。真棒 –

1

我也得到了同樣的問題,我只是去

首頁 - > .vagrant.d - > TMP

現在,這裏一個zip文件會在那裏,請刪除一個和你完成。

13

剛轉到C:\用戶\ YourUSERNAME \ .vagrant.d \ tmp目錄

,並刪除所有文件,然後再次鍵入以下命令

流浪漢框中添加laravel /宅基地

那它享受......

+0

感謝您爲臨時文件提供Windows位置! – Reisclef

+0

這裏已經空了...... =/ – giovannipds

11

嘗試:

vagrant box add laravel/homestead -c 
+1

你沒有看清楚這個問題嗎?在你提出的問題中,究竟什麼是失敗的工作,也就是問題。 – ydobonebi

+5

@ydobonebi標誌'-c'的文檔狀態爲:「清除所有臨時下載文件」。使用此標誌刪除與.vagrant.d/tmp /中的部分下載相關的文件,然後嘗試添加該框。它在行爲上等同於刪除.vagrant.d/tmp目錄的內容,然後重試添加該框。 –

0

我解決了這個編輯。JSON文件中:~/.vagrant.d/data/machine-index 刪除的關鍵machines值樣型

cd ~ 

"machines": {...}"machines":{}

1

然後鍵入

rm -rf .vagrant.d 

應該把它做那。

0

要下載文件,您必須在URL中添加版本和提供程序。例如對於下載precise64首先你需要它的網址是https://atlas.hashicorp.com/ubuntu/boxes/trusty64

然後你必須添加版本和提供商後,我們的例子下載網址是。

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

然後,你必須從你的無業遊民本地文件添加它。

要在本地將它添加到無業遊民文件中使用以下命令

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

這將創建vagrantfile,你可以配置無業遊民文件。

7

如果您使用的是Vagrant V2,那麼您可以在添加框時使用--clean標誌。

vagrant box add laravel/homestead --clean 

--clean - 如果給定的,流浪將從同一個URL之前下載刪除任何舊的臨時文件。如果您不希望Vagrant從前一點恢復下載,這可能很有用,可能是因爲內容更改了。

Vagrant Documentation

+0

它的工作。如果我試圖用** - 不安全的**進行下載,則無法正常工作。謝謝 –

0

我只是簡單地恢復之前幾次才最終完成的過程。我認爲主要的問題是互聯網連接,它在我的家裏徘徊。最清潔的方式肯定是其他人已經建議的,再加上移動到一個穩定連接的地方。

0

這是一個存儲庫問題,有時取決於流浪的版本。更新流浪者可以工作,但如果問題仍然存在,你必須嘗試使用​​存檔的流浪者版本。