Ruby错误消息启动流浪汉

时间:2015-01-20 19:36:15

标签: ruby vagrant

我曾经用vagrant启动我的本地虚拟机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
但我删除了所有我在虚拟机中的虚拟机,但我仍然得到这个错误随时我想与流浪汉做任何事情。似乎流浪汉本身有一些问题。所以我想我尝试的脚本与此错误无关。

/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文件夹而不是版本号文件夹

2 个答案:

答案 0 :(得分:2)

我发现了:

我在

中创建了一个.git存储库
~/.vagrant.d/boxes/box-cutter-VAGRANTSLASH-debian77-i386

所以流浪汉试图读取那个应该只有数字命名的文件夹的文件夹。

我删除了.git文件夹,但它有效

答案 1 :(得分:1)

我得到了类似的流浪汉配置错误。

出于某种原因,在更新流浪汉文件的特定配置上的repos时,这可能会弄乱流浪盒。在我的情况下,我正在升级vagrant和virtualbox以及对vagrantfile的一些其他更改。

我不得不去

 ~/.vagrant.d/boxes/

并删除我的旧盒子。