在carrierwave gem上捆绑安装错误

时间:2012-05-10 05:33:28

标签: ruby-on-rails ruby ruby-on-rails-3 rubygems carrierwave

我正在尝试安装gem(carrierwave),当我使用命令bundle install时,我遇到如下错误:

  

中的gemspec无效   [/home/sup1re/superrrr/vendor/bundle/ruby/1.8/specifications/carrierwave-0.6.2.gemspec]:   不合格的要求[“#   1.1.4" ]

  

安装carrierwave(0.6.2)inms中的gemspec无效   [/home/sup1re/superrrr/vendor/bundle/ruby/1.8/specifications/carrierwave-0.6.2.gemspec]:   不合格的要求[“#   1.1.4" ]

我还试图运行“gem update --system

我收到了这个错误

enter image description here

[1]: http://i.stack.imgur.com/RUxW9.png

规格:

  

ruby​​ 1.8.7(2011-02-18 patchlevel 334)[x86_64-linux]

     

Rails 3.2.3

     

宝石版本为1.8.5

我想知道我的Gemfile有什么问题。

非常欢迎任何评论。 谢谢。

以下是导致错误的carrierwave-0.6.2.gemspec

# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
  s.name = %q{carrierwave}
  s.version = "0.6.2"

  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
  s.authors = [%q{Jonas Nicklas}]
  s.date = %q{2012-04-12}
  s.description = %q{Upload files in your Ruby applications, map them to a range of ORMs, store them on different backends.}
  s.email = [%q{jonas.nicklas@gmail.com}]
  s.extra_rdoc_files = [%q{README.md}]
  s.files = [%q{README.md}]
  s.homepage = %q{https://github.com/jnicklas/carrierwave}
  s.rdoc_options = [%q{--main}]
  s.require_paths = [%q{lib}]
  s.rubyforge_project = %q{carrierwave}
  s.rubygems_version = %q{1.8.5}
  s.summary = %q{Ruby file upload library}

  if s.respond_to? :specification_version then
    s.specification_version = 3

    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
      s.add_runtime_dependency(%q<activesupport>, [">= 3.2.0"])
      s.add_runtime_dependency(%q<activemodel>, [">= 3.2.0"])
      s.add_development_dependency(%q<mysql2>, [">= 0"])
      s.add_development_dependency(%q<rails>, [">= 3.2.0"])
      s.add_development_dependency(%q<cucumber>, ["#<YAML::Syck::DefaultKey:0x718a860d0a98> 1.1.4"])
      s.add_development_dependency(%q<json>, [">= 0"])
      s.add_development_dependency(%q<rspec>, ["~> 2.0"])
      s.add_development_dependency(%q<sham_rack>, [">= 0"])
      s.add_development_dependency(%q<timecop>, [">= 0"])
      s.add_development_dependency(%q<fog>, [">= 1.3.1"])
      s.add_development_dependency(%q<mini_magick>, [">= 0"])
      s.add_development_dependency(%q<rmagick>, [">= 0"])
    else
      s.add_dependency(%q<activesupport>, [">= 3.2.0"])
      s.add_dependency(%q<activemodel>, [">= 3.2.0"])
      s.add_dependency(%q<mysql2>, [">= 0"])
      s.add_dependency(%q<rails>, [">= 3.2.0"])
      s.add_dependency(%q<cucumber>, ["#<YAML::Syck::DefaultKey:0x718a860d0a98> 1.1.4"])
      s.add_dependency(%q<json>, [">= 0"])
      s.add_dependency(%q<rspec>, ["~> 2.0"])
      s.add_dependency(%q<sham_rack>, [">= 0"])
      s.add_dependency(%q<timecop>, [">= 0"])
      s.add_dependency(%q<fog>, [">= 1.3.1"])
      s.add_dependency(%q<mini_magick>, [">= 0"])
      s.add_dependency(%q<rmagick>, [">= 0"])
    end
  else
    s.add_dependency(%q<activesupport>, [">= 3.2.0"])
    s.add_dependency(%q<activemodel>, [">= 3.2.0"])
    s.add_dependency(%q<mysql2>, [">= 0"])
    s.add_dependency(%q<rails>, [">= 3.2.0"])
    s.add_dependency(%q<cucumber>, ["#<YAML::Syck::DefaultKey:0x718a860d0a98> 1.1.4"])
    s.add_dependency(%q<json>, [">= 0"])
    s.add_dependency(%q<rspec>, ["~> 2.0"])
    s.add_dependency(%q<sham_rack>, [">= 0"])
    s.add_dependency(%q<timecop>, [">= 0"])
    s.add_dependency(%q<fog>, [">= 1.3.1"])
    s.add_dependency(%q<mini_magick>, [">= 0"])
    s.add_dependency(%q<rmagick>, [">= 0"])
  end
end

3 个答案:

答案 0 :(得分:5)

您需要更新Rubygems,这不是载波问题。 sudo gem update --systemgem update --system取决于您的设置。

答案 1 :(得分:3)

您需要更新rubygems,但首先您需要修复损坏的gemspec。

在编辑器中打开.../specifications/carrierwave-0.6.2.gemspec,然后删除#<YAML::Syck::DefaultKey:0x718a860d0a98>的所有实例。 (或sed -i 's/#<.*> //' blah.gemspec。)

然后按其他地方的说明运行gem update --system

答案 2 :(得分:0)

对我来说,这个问题出现在我使用RVM的Ruby版本中。当尝试在ruby 1.8.7中安装carrierwave gem时,它失败了,而我的应用程序正在使用ruby 1.9.3。

我通过让我的应用根级别的文件.rvmrc拥有我需要的正确版本的ruby来解决这个问题:

rvm use ruby-1.9.3-p385