Windows 8.1:Vagrant无法检测到VirtualBox!确保正确安装VirtualBox

Dan*_*aws 6 vagrant

这个问题是我将回答的问题,希望任何有同样问题的人能够解决问题而不会像我那样过多地敲打头!

我刚刚按照他们网站上的说明安装了VirtualBox(4.3.16)和Vagrant(1.3.5).在我达到运行命令的程度之前,一切看起来都非常简单明了:流浪汉了

这立即返回错误:

Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.

Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.
Run Code Online (Sandbox Code Playgroud)

这是一个惊人的错误信息......我应该在哪里找到这个PATH变量???

ssc*_*rth 11

您需要vagrant从提升的提示符运行,即cmd需要"以管理员身份运行".

Vagrant(或者VBoxManage.exe,就此而言)不需要在您的PATH环境变量中.Virtual Box安装程序会自动设置VBOX_INSTALL_PATHVBOX_MSI_INSTALL_PATH使用Vagrant查找的环境变量,但Vagrant除非提升,否则无法运行它.

  • 这也适用于Windows 10. (2认同)

Dan*_*aws 7

我找到了很多关于如何解决这个问题的建议,但是直到我终于发现有人提到VirtualBox已经重命名了一个变量名称时我们都没有找到帮助,我还没有找到哪里,所以经过一些挖掘之后,这就是最终解决问题的解决方案工作:

查找以下文件(Windows 8.1上的默认安装路径):

C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.3.5\plugins\providers\virtualbox\driver\base.rb
Run Code Online (Sandbox Code Playgroud)

在您喜欢的文本编辑器中打开此文件并执行搜索并将VBOX_INSTALL_PATH的所有实例替换为VBOX_MSI_INSTALL_PATH

希望这有助于有人开始使用Vagrant和VirtualBox!