基礎安裝
VirtualBox ,夜神安卓模擬器也用的是這個,
vagrant
安裝 Homestead Vagrant Box
- 執行命令
vagrant box add laravel/homestead
,報錯:$ vagrant box add laravel/homestead ==> box: Loading metadata for box 'laravel/homestead' box: URL: https://vagrantcloud.com/laravel/homestead ==> box: Adding box 'laravel/homestead' (v8.2.1) for provider: virtualbox box: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/8.2.1/providers/virtualbox.box box: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com box: An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again. Could not resolve host: vagrantcloud-files-production.s3.amazonaws.com
直接複製下載地址:
https://vagrantcloud.com/laravel/boxes/homestead/versions/8.2.1/providers/virtualbox.box
手動下載檔案 - 再次本地安裝 :
$ vagrant box add laravel/homestead ./virtualbox.box ==> box: Box file was not detected as metadata. Adding it directly... ==> box: Adding box 'laravel/homestead' (v0) for provider: box: Unpacking necessary files from: file://C:/Users/Administrator.WINMICR-HV2FT70/Homestead/virtualbox.box box: ==> box: Successfully added box 'laravel/homestead' (v0) for 'virtualbox'!
貌似安裝成功了吧,這裡的
./virtualbox.box
是剛才下載的檔案路徑,修改成自己的就好了; - 執行
homestead/init.bat
檔案,生成Homestead.yaml
配置檔案; - 執行
vagrant up
,報錯了:$ vagrant up Bringing machine 'homestead' up with 'virtualbox' provider... ==> homestead: Box 'laravel/homestead' could not be found. Attempting to find and install... homestead: Box Provider: virtualbox homestead: Box Version: >= 8.0 ==> homestead: Loading metadata for box 'laravel/homestead' homestead: URL: https://vagrantcloud.com/laravel/homestead ==> homestead: Adding box 'laravel/homestead' (v8.2.1) for provider: virtualbox homestead: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/8.2.1/providers/virtualbox. homestead: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com homestead: An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again. Could not resolve host: vagrantcloud-files-production.s3.amazonaws.com
emmmm,還是這個錯呢,可是我明明安裝過了,繼續找..
- 找到了資料,在
C:\Users\Administrator.WINMICR-HV2FT70\.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead
中會存在0
這個檔案,重新命名為8.2.1
(自己對應的box版本號),應該好了吧; - 再次回到第三步->第四部,然鵝依然報錯:
$ vagrant up Bringing machine 'homestead' up with 'virtualbox' provider... ==> homestead: Importing base box 'laravel/homestead'... ==> homestead: Matching MAC address for NAT networking... ==> homestead: Checking if box 'laravel/homestead' version '8.2.1' is up to date... The box 'laravel/homestead' is not a versioned box. The box was added directly instead of from a box catalog. Vagrant can only check the versions of boxes that were added from a catalog such as from the public Vagrant Server.
大概就是不認我手動改的唄,得,革命尚未成功,同志任需努力啊~
- 終於又找到了,有大神說要在回到第五步,修改名稱後,在當前資料夾下執行命令
echo 'https://vagrantcloud.com/laravel/boxes/homestead/' > metadata_url
; vagrant up && vagrant ssh
終於是好了,記錄一下.
本作品採用《CC 協議》,轉載必須註明作者和本文連結