Ruby 启动 vagrant 的错误信息

Ruby error message starting vagrant

我曾经用 vagrant 启动我的本地 VM gc-gw0:

vagrant up gc-gw0

但是从今天开始我得到了这个错误:

/usr/lib/ruby/2.1.0/rubygems/version.rb:202:in `initialize': 
        Malformed version number string .git (ArgumentError)
        from /usr/lib/ruby/2.1.0/rubygems/version.rb:192:in `new'
        from /usr/lib/ruby/2.1.0/rubygems/version.rb:192:in `new'
        from /usr/lib/ruby/vendor_ruby/vagrant/box_collection.rb:274:in `block (2 levels) in find'
        from /usr/lib/ruby/vendor_ruby/vagrant/box_collection.rb:271:in `map'
        from /usr/lib/ruby/vendor_ruby/vagrant/box_collection.rb:271:in `block in find'
        from /usr/lib/ruby/vendor_ruby/vagrant/box_collection.rb:423:in `block in with_collection_lock'
        from /usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
        from /usr/lib/ruby/vendor_ruby/vagrant/box_collection.rb:422:in `with_collection_lock'
        from /usr/lib/ruby/vendor_ruby/vagrant/box_collection.rb:264:in `find'
        from /usr/lib/ruby/vendor_ruby/vagrant/vagrantfile.rb:157:in `block in machine_config'
        from /usr/lib/ruby/vendor_ruby/vagrant/vagrantfile.rb:190:in `call'
        from /usr/lib/ruby/vendor_ruby/vagrant/vagrantfile.rb:190:in `machine_config'
        from /usr/lib/ruby/vendor_ruby/vagrant/vagrantfile.rb:45:in `machine'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:503:in `machine'
        from /usr/lib/ruby/vendor_ruby/vagrant/plugin/v2/command.rb:168:in `block in with_target_vms'
        from /usr/lib/ruby/vendor_ruby/vagrant/plugin/v2/command.rb:192:in `call'
        from /usr/lib/ruby/vendor_ruby/vagrant/plugin/v2/command.rb:192:in `block in with_target_vms'
        from /usr/lib/ruby/vendor_ruby/vagrant/plugin/v2/command.rb:174:in `each'
        from /usr/lib/ruby/vendor_ruby/vagrant/plugin/v2/command.rb:174:in `with_target_vms'
        from /usr/share/vagrant/plugins/commands/up/command.rb:67:in `block in execute'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:239:in `block (2 levels) in batch'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:237:in `tap'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:237:in `block in batch'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:236:in `synchronize'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:236:in `batch'
        from /usr/share/vagrant/plugins/commands/up/command.rb:58:in `execute'
        from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in `execute'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:258:in `cli'
        from /usr/bin/vagrant:173:in `<main>'

奇怪的是,我昨天还是这样启动没问题。

我为这个错误搜索了很多但还没有提示。此错误消息是什么意思?整个消息的主要错误是什么?

我用

$ vagrant -v
Vagrant 1.6.5
$ ruby -v
ruby 2.1.2p95 (2014-05-08) [i386-linux-gnu]

Vagrantfile 和 bootstrap-testnode.sh 文件在这里:rubo77/freifunk-gluon-example-node
但是我删除了 virtualbox 中的所有虚拟机,但每当我想对 vagrant 做任何事情时,我仍然会收到此错误。似乎流浪者本身有一些问题。所以我想我试过的脚本与这个错误无关。

/usr/lib/ruby/2.1.0/rubygems/version.rb 中的第 202 行是这样的:

def initialize version
    raise ArgumentError, "Malformed version number string #{version}" unless
      self.class.correct?(version)

    @version = version.to_s.strip.gsub("-",".pre.")
    @segments = nil
  end

因此 ruby 似乎正在检查 .git 文件夹而不是版本号文件夹

我发现:

我在里面创建了一个 .git 存储库

~/.vagrant.d/boxes/box-cutter-VAGRANTSLASH-debian77-i386

所以 vagrant 试图读取那个文件夹,其中应该只有以数字命名的文件夹。

我删除了那个 .git 文件夹并且它起作用了

我遇到了类似的 vagrant 配置错误。

由于某些原因,在更新 vagrant 文件的特定配置的 repos 时,这可能会弄乱 vagrant 框。在我的例子中,我升级了 vagrant 和 virtualbox,并对 vagrantfile 进行了一些其他更改。

我必须去

 ~/.vagrant.d/boxes/

并删除我的旧盒子。