首先要提前感谢:)
当我尝试在rails应用程序中安装gem时,它会显示如下所示的错误。
$ rake gems:install
Invalid gemspec in [/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/specifications/carmen-1.0.0.beta2.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0x7f630b62a000> 2.6.1"]
rake aborted!
undefined method `source_index' for Gem:Module
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.8/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.8/lib/initializer.rb:298:in `add_gem_load_paths'
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.8/lib/initializer.rb:132:in `process'
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
/home/aspireedge/Aspiree/pyromaniac/config/environment.rb:16
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.8/lib/tasks/misc.rake:4
/home/aspireedge/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.8/lib/tasks/gems.rake:17
Tasks: TOP => environment
(See full trace by running task with --trace)
当我尝试更新gem
时 $ gem update --system
Latest version currently installed. Aborting.
我也尝试用rvm gemset empty
但仍然有错误
答案 0 :(得分:0)
尝试升级您的RubyGems并删除并再次安装carmen gem:
gem update --system
gem uninstall carmen
gem install carmen
为Ubuntu 14.04 +提供了最新版本的Ruby 2.x的PPA:
$ sudo apt-get remove rubygems
$ sudo apt-add-repository ppa:brightbox/ruby-ng
$ sudo apt-get update
$ sudo apt-get install ruby2.4
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux-gnu]