Windows 10 安装 Homestead 问题记录 
                                                    
                        
                    
                    
  
                    
                    homestead在mac上装了很多次,问题还好,但是在windows上总是各种问题。总得来说主要还是版本比较多,这次一步步learnku提供的教程安装,只遇到一个问题。
总体步骤严格安装文档 开发环境搭建 - Windows
一、盒子名称不对应
$  vagrant box add metadata.json
==> vagrant: A new version of Vagrant is available: 2.2.9 (installed version: 2.2.6)!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html
==> box: Loading metadata for box 'metadata.json'
    box: URL: file://D:/BaiduNetdiskDownload/lc-homestead-8.2.1-2019112300/metadata.json
==> box: Adding box 'lc/homestead' (v8.2.1) for provider: virtualbox
    box: Downloading: virtualbox.box
    box:
==> box: Successfully added box 'lc/homestead' (v8.2.1) for 'virtualbox'!
$ vagrant box list
lc/homestead (virtualbox, 8.2.1)执行vagrant up报找不到box
应该在执行前将metadata.json里的名称改掉
{
    "name": "laravel/homestead",
    "versions": 
    [
        {
            "version": "8.0.1",
            "providers": [
                {
                  "name": "virtualbox",
                  "url": "virtualbox.box"
                }
            ]
        }
    ]
}二、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.cppgithub上看到,说要安装驱动 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 协议》,转载必须注明作者和本文链接
 
           CR 的个人博客
 CR 的个人博客
         
             
             
                     
                     
           
           关于 LearnKu
                关于 LearnKu
               
                     
                     
                     粤公网安备 44030502004330号
 粤公网安备 44030502004330号 
 
推荐文章: