rails 2.2 with ruby​​ 1.9.2 undefined method`source_index'for Gem:Module

时间:2021-06-08 01:16:27

I am try to setup the development env for my rails 2 application using ruby 1.9.2. While I am giving rake db:create command I got the following error. I also change the version to 1.8.7 then also getting the same error

我尝试使用ruby 1.9.2为我的rails 2应用程序设置开发环境。当我给rake db:create命令时,我收到以下错误。我也将版本更改为1.8.7然后也得到相同的错误

  rake aborted!
  undefined method `source_index' for Gem:Module
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/initializer.rb:273:in `add_gem_load_paths'
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/initializer.rb:131:in `process'
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/initializer.rb:112:in `run'
  /home/dharin/rails_projects/hesistudy_dev/config/environment.rb:24:in `<top (required)>'
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `block in require'
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
  /home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/tasks/misc.rake:3:in `block in <top (required)>'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:634:in `call'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:629:in `each'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:629:in `execute'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain' 
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:602:in `each'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:581:in `invoke'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2019:in `each'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:1992:in `run'
  /home/dharin/.rvm/rubies/ruby-1.9.2-p320/bin/rake:31:in `<main>'

1 个解决方案

#1


0  

Ruby 1.9.2 isn't that new, you should use 1.9.3-p448. Rubygems 1.8.25 is very old, and should be used with Ruby 1.8 only AFAIK. You are probably using a very old distro. Try using rvm to install the latest Ruby 1.9 and Rubygems. Here's a brief quick-start guide. Refer to the docs in case of troubles.

Ruby 1.9.2不是那么新,你应该使用1.9.3-p448。 Rubygems 1.8.25非常老,应该只与Ruby 1.8一起使用AFAIK。你可能正在使用一个非常古老的发行版。尝试使用rvm安装最新的Ruby 1.9和Rubygems。这是一个简短的快速入门指南。遇到麻烦时请参阅文档。

\curl -L https://get.rvm.io | bash -s stable
rvm install 1.9
rvm use 1.9 --default
rvm rubygems latest --verify-downloads 1
gem install bundler
bundle exec ./script/server

#1


0  

Ruby 1.9.2 isn't that new, you should use 1.9.3-p448. Rubygems 1.8.25 is very old, and should be used with Ruby 1.8 only AFAIK. You are probably using a very old distro. Try using rvm to install the latest Ruby 1.9 and Rubygems. Here's a brief quick-start guide. Refer to the docs in case of troubles.

Ruby 1.9.2不是那么新,你应该使用1.9.3-p448。 Rubygems 1.8.25非常老,应该只与Ruby 1.8一起使用AFAIK。你可能正在使用一个非常古老的发行版。尝试使用rvm安装最新的Ruby 1.9和Rubygems。这是一个简短的快速入门指南。遇到麻烦时请参阅文档。

\curl -L https://get.rvm.io | bash -s stable
rvm install 1.9
rvm use 1.9 --default
rvm rubygems latest --verify-downloads 1
gem install bundler
bundle exec ./script/server