记录一次解决vagrant报错及解决方案
报错如下
The provider 'virtualbox' that was requested to back the machine
'homestead' is reporting that it isn't usable on this system. The
reason is shown below:
Vagrant has detected that you have a version of VirtualBox installed
that is not supported by this version of Vagrant. Please install one of
the supported versions listed below to use Vagrant:
4.0, 4.1, 4.2, 4.3, 5.0, 5.1, 5.2, 6.0
A Vagrant update may also be available that adds support for the version
you specified. Please check www.vagrantup.com/downloads.html to download
the latest version.
Vagrant 2.2.6
VirtualBox 6.1
问题原因:vargrant 不支持当前 vbox 版本
解决方案:
1.重装一个低版本的virtualbox
2.修改vargrant配置:
1) 修改 plugin.rb
文件位置vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/plugin.rb
添加一行
autoload :Version_6_1, File.expand_path("../driver/version_6_1", __FILE__)
大概在这个位置
2)修改 meta.rb
文件位置:
Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\driver\meta.rb
添加一行
"6.1" => Version_6_1,
同时在当前位置下新建 version_6_1.rb 文件
文件内容如下
require File.expand_path("../version_6_0", __FILE__)
module VagrantPlugins
module ProviderVirtualBox
module Driver
# Driver for VirtualBox 6.1.x
class Version_6_1 < Version_6_0
def initialize(uuid)
super
@logger = Log4r::Logger.new("vagrant::provider::virtualbox_6_1")
end
end
end
end
end
重新启动vagrant
vagrant up