在 windows 上安装 Vagrant 的问题
Posted
技术标签:
【中文标题】在 windows 上安装 Vagrant 的问题【英文标题】:Problem with Vagrant Installation on windows 【发布时间】:2021-10-10 10:34:39 【问题描述】:我打算使用 homestead 在 Windows 上开发一个 laravel 应用程序。 所以我安装了 VirtualBox,然后又安装了 Vagrant,它按预期进行。 但是当我在命令行上输入 vagrant 并按 Enter 以确保它正常工作时,我看到了这个错误:
Traceback (most recent call last):
2: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/bin/vagrant:111:in `<main>'
1: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- vagrant (LoadError)
32: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/bin/vagrant:111:in `<main>'
31: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:147:in `require'
30: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `rescue in require'
29: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `require'
28: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/lib/vagrant.rb:338:in `<top (required)>'
27: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/lib/vagrant.rb:338:in `each'
26: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/lib/vagrant.rb:346:in `block in <top (required)>'
25: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/lib/vagrant.rb:346:in `each'
24: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/lib/vagrant.rb:329:in `block in <top (required)>'
23: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/lib/vagrant.rb:329:in `load'
22: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant-2.2.18/plugins/commands/cloud/plugin.rb:2:in `<top (required)>'
21: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
20: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
19: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/vagrant_cloud-3.0.5/lib/vagrant_cloud.rb:1:in `<top (required)>'
18: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
17: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
16: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/excon-0.85.0/lib/excon.rb:38:in `<top (required)>'
15: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
14: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
13: from C:/HashiCorp/Vagrant/embedded/gems/2.2.18/gems/excon-0.85.0/lib/excon/socket.rb:2:in `<top (required)>'
12: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
11: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
10: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/resolv.rb:38:in `<top (required)>'
9: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/resolv.rb:168:in `<class:Resolv>'
8: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/resolv.rb:171:in `<class:Hosts>'
7: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
6: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
5: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/win32/resolv.rb:7:in `<top (required)>'
4: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
3: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
2: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/win32/registry.rb:4:in `<top (required)>'
1: from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/win32/registry.rb:72:in `<module:Win32>'
C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/win32/registry.rb:72:in `find': unknown encoding name - CP720 (ArgumentError)
我已经安装了 VirtualBox 6.1.26 和 Vagrant 2.2.18 64 位。我的 Windows 上启用了虚拟化。我也禁用了hyper-v。 有没有人知道哪里错了?
【问题讨论】:
#reza @reza 请指定应用程序版本,例如虚拟盒子版本 e.t.c @peter 我编辑了这个问题。谢谢。 从 2.2.18 的 6.1.26 vagrant 2.0.0 将应用程序版本降低到虚拟框 5.1.26 @peter 我想使用最新版本的 laravel,它需要 VirtualBox 6.1.x @peter 我刚刚安装了 vagrant 2.0.0 并且成功了!谢谢彼得 【参考方案1】:解决方案#1
降低应用版本 从 6.1.26 到虚拟盒子 5.1.26 和 vagrant 2.0.0 来自 2.2.18
解决方案#2
重新安装应用
【讨论】:
这在 Windows 10 上不起作用,当您尝试运行虚拟框管理器时,它只会抛出此应用程序无法启动的消息,因为它会导致 Windows 上的安全和性能问题以上是关于在 windows 上安装 Vagrant 的问题的主要内容,如果未能解决你的问题,请参考以下文章
在 Windows10 上使用 VirtualBox 的 Vagrant:在您的 PATH 上找不到“Rsync”