如何修复“vagrant up”错误“未初始化常量 VagrantPlugins::HostDarwin::Cap::Version”

mee*_*eep 5 vagrant

执行时vagrant up我收到此错误:

==> default: Exporting NFS shared folders...
Traceback (most recent call last):
    106: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/batch_action.rb:86:in `block (2 levels) in run'
    105: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:201:in `action'
.....

/opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb:20:in `resolve_host_path': uninitialized constant VagrantPlugins::HostDarwin::Cap::Version (NameError)
Run Code Online (Sandbox Code Playgroud)

我更新了 Vagrant 和 VirtualBox。我怎样才能解决这个问题?

Zet*_*eth 11

解决方案是运行以​​下命令:

sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb 
Run Code Online (Sandbox Code Playgroud)

这个命令是在这里找到的。


小智 1

我也有同样的错误:

uninitialized constant VagrantPlugins::HostDarwin::Cap::Version (NameError)
Run Code Online (Sandbox Code Playgroud)

将 Vagrant 从 降级2.2.19为2.2.18为我解决了这个问题。