Windows 10 安裝 Homestead 問題記錄

zhangsen發表於2020-06-14

homestead在mac上裝了很多次,問題還好,但是在windows上總是各種問題。總得來說主要還是版本比較多,這次一步步learnku提供的教程安裝,只遇到一個問題。

總體步驟嚴格安裝文件 開發環境搭建 - Windows

一、vargrant up 報錯

C:\Users\55480\Homestead (master)
λ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Checking if box 'laravel/homestead' version '8.2.1' is up to date...
==> homestead-7: Setting the name of the VM: homestead-7
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> homestead-7: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Querying NetCfgInstanceId failed (0x00000002)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp

github上看到,說要安裝驅動 github.com/hashicorp/vagrant/issue...

If you're running on windows try the following, from VirtualBox forum post

Go to C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv directory, right click on VBoxDrv.inf and select Install.

Go to console and enter 'sc start vboxdrv'.

Then try 'vagrant up'. Worked for my issue.

問題解決

二、 192.168.10.10 homestead.test

檢視日誌

vagrant@homestead:/var/log/nginx$ tail -f homestead.test-error.log
PHP message: PHP  11. Illuminate\Foundation\Application->call() /home/vagran
2020/06/13 17:19:18 [error] 854#854: *1 FastCGI sent in stderr: "ider->boot() /home/vagrant/Code/Laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:33
PHP message: PHP  18. Carbon\Laravel\ServiceProvider->updateLocale() /home/vagrant/Code/Laravel/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php:20
PHP message: PHP  19. Carbon\Carbon::setLocale() /home/vagrant/Code/Laravel/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php:40
PHP message: PHP  20. Carbon\Carbon::getLocaleAwareTranslator() /home/vagrant/Code/Laravel/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php:480
PHP message: PHP  21. Carbon\Carbon::translator() /home/vagrant/Code/Laravel/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php:728
PHP message: PHP  22. spl_autoload_call() /home/vagrant/Code/Laravel/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php:691
PHP message: PHP  23. Composer\Autoload\ClassLoader->loadClass() /home/vagrant/Code/Laravel/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php:691
PHP message: PHP  24. Composer\Autoload\includeFile() /home/vagrant/Code/Laravel/vendor/composer/ClassLoader.php:322
PHP message: PHP  25. include() /home/vagrant/Code/Laravel/vendor/composer/ClassLoader.php:444" while reading response header from upstream, client: 192.168.10.1, server: homestead.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "192.168.10.10"

分析:
環境版本7.4,報錯7.1,估計就是版本沒對上
剛好看到有人也遇到這個問題,貼上下面的回答

vagrant ssh 登入到 shell
sudo vim /etc/nginx/sites-enable/homestead.test
找到 php7.1-fpm 改成 php7.4-fpm
sudo systemctl restart nginx 大功告成
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章