本文介绍了`add_frozen_gem_path':未定义的方法`source_index'为Gem:Module(NoMethodError)或者Gem.source_index被弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用rails 2.3.11,ruby-1.9.2-p320。
尝试运行脚本/服务器但出现此错误: - $ / b
$ b

  system @ admin:〜/ apps / app_name /主干$ script / server 
=>引导WEBrick
=> Rails 2.3.11应用程序从http://0.0.0.0:3000开始
/home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/ rails / gem_dependency.rb:21:在`add_frozen_gem_path'中:未定义的方法`source_index'为Gem:Module(NoMethodError)
from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/ gems / rails-2.3.11 / lib / initializer.rb:298:在`add_gem_load_paths'中
来自/home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3 .11 / lib / initializer.rb:132:在'process'中
from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/ initializer.rb:113:'run'
from /home/system/apps/app_name/trunk/config/environment.rb:9:in`< top(required)>'
from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in`require'
from / home / system / .rvm / rubies / ruby​​-1.9.2-p320 / lib / ruby​​ / site_ruby / 1.9.1 / ruby​​gems / core_ext / kernel_require.rb:126:在'require'中
from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in`block in require'
from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in`new_constants_in'
from / home / system /.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:在'require'中$ / $ / b / home / system /。 rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/commands/server.rb:84:在<顶部(必填)>'
from / home /system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73:in`require'
from / home / system / .rvm / rubies / ruby​​-1.9.2-p320 / lib / ruby​​ / site_ruby / 1.9.1 / ruby​​gems / core_ext / kernel_require.rb:73:'require'
脚本/服务器:3: < main>'

然后,我提到了几个关于SO的答案,并从终端: - $ /

  system @ admin:〜/ apps / app_name / trunk $ gem update --system 1.8.25 

现在出现错误: -

  system @ admin:〜/ apps / app_name / trunk $ script / server 
=>引导WEBrick
=> Rails 2.3.11应用程序从http://0.0.0.0:3000
开始注意:不推荐使用Gem.source_index,使用Specification。它将在2011年11月1日或之后删除。
Gem.source_index从/home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/gem_dependency.rb:21调用。
注意:Gem :: SourceIndex#刷新!已弃用,无需替换。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#刷新!从/home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:34调用。
注意:不推荐使用Gem :: SourceIndex#load_gems_in。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#load_gems_in从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:322调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注意:Gem :: SourceIndex#add_spec已弃用,请使用Specification.add_spec。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#add_spec从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127中调用。
注:不推荐使用Gem :: SourceIndex#initialize。它将在2011年11月1日或之后删除。
Gem :: SourceIndex#initialize从/home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:100调用。
/home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/gem_dependency.rb:277:in`==':undefined method actionmailer的name:字符串(NoMethodError)从/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb获得
:217:在`==='
from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:217:在`block in match_specs'
from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:412:in`block在每个'
from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:411:in`each'$ b $ from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:411:in`each'
from / home /system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:216:in`find_all'
from /home/system/.rvm /rubies/ruby-1.9.2-p320/lib/ru by / site_ruby / 1.9.1 / ruby​​gems / dependency.rb:216:在`matching_specs'中
来自/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9 .1 / ruby​​gems / dependency.rb:238:在`to_specs'中
from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/ dependency.rb:256:在`to_spec'
from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/gem_dependency.rb:75:in`add_load_paths'
from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:301:in`block in add_gem_load_paths'
from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:301:in`each'
from / home / system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:301:在`add_gem_load_paths'中
来自/home/system/.rvm/宝石/红宝石1.9.2-P320 @ gemset_name / gems / rails-2.3.11 / lib / initializer.rb:132:在`process'
from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/ rails-2.3.11 / lib / initializer.rb:113:'run'
from /home/system/apps/app_name/trunk/config/environment.rb:9:in`< top(required) >'来自/home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in`require'$ b的
$ / from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in`require'
from / home /system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in`block in require'
from / home / system /.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:从/ home / system /中的`new_constants_in'
中。 rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:在'require'
f rom /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/commands/server.rb:84:in`< top(required)>'
from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in`require'
from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in`require'
from script / server:3 :在< main>'

以下是我的environment.rb: -

 #修改此文件时一定要重新启动服务器

#指定供应商/ rails不存在
RAILS_GEM_VERSION ='2.3.11'除非定义? RAILS_GEM_VERSION

#引导Rails环境,框架和默认配置
需要File.join(File.dirname(__ FILE__),'boot')

Rails: :Initializer.run do | config |

config.gem'jrails'

#config / environments / *中的设置优先于此处指定的设置。
#应用程序配置应该放入config / initializers中的文件
# - 该目录中的所有.rb文件会自动加载。

#为您自定义的目录添加额外的载入路径
#config.autoload_paths + =%W(#{RAILS_ROOT} / extras)

#指定gems这个应用程序依赖于并安装了rake gems:install
#config.gembj
#config.gemhpricot,:version => '0.6',:source => http://code.whytheluckystiff.net
#config.gemsqlite3-ruby,:lib => sqlite3
#config.gemaws-s3,:lib => aws / s3

#只按照给定的顺序加载这里命名的插件(默认是按字母顺序排列)。
#:所有可用作所有插件的占位符,并非明确命名为
#config.plugins = [:exception_notification,:ssl_requirement,:all]

#跳过框架我不打算使用。要使用不带数据库的Rails,
#必须删除Active Record框架。
#config.frameworks - = [:active_record,:active_resource,:action_mailer]

#激活应该始终运行的观察者
#config.active_record.observers =:cacher, :garbage_collector,:forum_observer

#将Time.zone默认设置为指定区域,并将Active Record自动转换为该区域。
#运行rake -D time获取查找时区名称的任务列表。
config.time_zone ='UTC'

#默认语言环境为:en,所有自config / locales / *。rb,yml的翻译都会自动加载。
#config.i18n.load_path + = Dir [Rails.root.join('my','locales','*。{rb,yml}')]
#config.i18n.default_locale = :de
end

以下是我的rakefile: - $ / b
$ b

 #在以.rake结尾的lib / tasks文件中添加自己的任务,例如lib / tasks / capistrano.rake以
#将自动提供给Rake。
$ b $ require(File.join(File.dirname(__ FILE__),'config','boot'))

require'rake'
require'rake / testtask'
require'rdoc / task'
require'tasks / rails'

以下是我提到的解决方案的答案: -





请帮助我物。
谢谢

解决方案

Ruby 1.9.2并不是那么新,你应该使用1.9.3-p448。 Rubygems 1.8.25非常古老,应该只与Ruby 1.8一起使用AFAIK。您可能正在使用一个非常老的发行版。尝试使用安装最新的Ruby 1.9和Rubygems。这里有一个简短的快速入门指南。

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


I am using rails 2.3.11, ruby-1.9.2-p320.Trying to run script/server but getting this error :-

system@admin:~/apps/app_name/trunk$ script/server
=> Booting WEBrick
=> Rails 2.3.11 application starting on http://0.0.0.0:3000
/home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path': undefined method `source_index' for Gem:Module (NoMethodError)
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:298:in `add_gem_load_paths'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:132:in `process'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:113:in `run'
    from /home/system/apps/app_name/trunk/config/environment.rb:9:in `<top (required)>'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `block in require'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/commands/server.rb:84:in `<top (required)>'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73:in `require'
    from script/server:3:in `<main>'

Then I refered to a few answers on SO and ran following command from terminal :-

system@admin:~/apps/app_name/trunk$ gem update --system 1.8.25

Now am getting the error :-

system@admin:~/apps/app_name/trunk$ script/server
=> Booting WEBrick
=> Rails 2.3.11 application starting on http://0.0.0.0:3000
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:34.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#load_gems_in called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:322.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:100.
/home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/gem_dependency.rb:277:in `==': undefined method `name' for "actionmailer":String (NoMethodError)
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:217:in `==='
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:217:in `block in matching_specs'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:412:in `block in each'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:411:in `each'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:411:in `each'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:216:in `find_all'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:216:in `matching_specs'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:238:in `to_specs'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/rails/gem_dependency.rb:75:in `add_load_paths'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:301:in `block in add_gem_load_paths'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:301:in `each'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:132:in `process'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/initializer.rb:113:in `run'
    from /home/system/apps/app_name/trunk/config/environment.rb:9:in `<top (required)>'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `block in require'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
    from /home/system/.rvm/gems/ruby-1.9.2-p320@gemset_name/gems/rails-2.3.11/lib/commands/server.rb:84:in `<top (required)>'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /home/system/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from script/server:3:in `<main>'

Following is my environment.rb :-

# Be sure to restart your server when you modify this file

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|

  config.gem 'jrails'

  # Settings in config/environments/* take precedence over those specified here.
  # Application configuration should go into files in config/initializers
  # -- all .rb files in that directory are automatically loaded.

  # Add additional load paths for your own custom dirs
  # config.autoload_paths += %W( #{RAILS_ROOT}/extras )

  # Specify gems that this application depends on and have them installed with rake gems:install
  # config.gem "bj"
  # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
  # config.gem "sqlite3-ruby", :lib => "sqlite3"
  # config.gem "aws-s3", :lib => "aws/s3"

  # Only load the plugins named here, in the order given (default is alphabetical).
  # :all can be used as a placeholder for all plugins not explicitly named
  # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

  # Skip frameworks you're not going to use. To use Rails without a database,
  # you must remove the Active Record framework.
  # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  # Run "rake -D time" for a list of tasks for finding time zone names.
  config.time_zone = 'UTC'

  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
  # config.i18n.default_locale = :de
end

Following is my rakefile :-

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'tasks/rails'

Following are the answers that I refered to for the solutions :-

Uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)

undefined method `name' for "actionmailer":String

Please help me in the matter.Thanks

解决方案

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.

\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

这篇关于`add_frozen_gem_path':未定义的方法`source_index'为Gem:Module(NoMethodError)或者Gem.source_index被弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 16:55