开发者

Why would an app run fine in the system environment, but not under RVM?

I'm trying to get up to speed with RVM.

I have a Rails 2 app that works fine within my system. In other words it worked before I installed RVM and it works if I "turn RVM off" with $ rvm use system.

Under RVM I installed the same Ruby version and patch level as my system Ruby, and then I created a gemset and installed all the gem versions that the app uses.

However, under RVM when I run rake gems I get this result...

$ rake gems
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
undefined method `name' for "actionmailer":String

Tasks: TOP => environment
(See full trace by running task with --trace)

With --trace...

$ rake gems --trace
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
** Invoke gems (first_time)
** Invoke gems:base (first_time)
** Execute gems:base
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `name' for "actionmailer":String
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/rails/gem_dependency.rb:277:in `=='
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `==='
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `matching_specs'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `find_all'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/specification.rb:410:in `each'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/specification.rb:409:in `each'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `find_all'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `matching_specs'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:238:in `to_specs'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems.rb:1210:in `gem'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/rails/gem_dependency.rb:75:in `add_load_paths'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `each'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:132:in `process'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:113:in `send'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:113:in `run'
/Users/username/project/my_app/config/environment.rb:7
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/tasks/misc.rake:4
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/tasks/gems.rake:17
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rake-0.9.2/bin/rake:32
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/bin/rake:19:in `load'
/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/bin/rake:19
Tasks: TOP => environment

When I try to run the app I get...

$ script/server 
=> Booting WEBr开发者_开发问答ick
=> 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 /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/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 /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/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 /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/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 /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.

[ ... "NOTE: Gem::SourceIndex" thing repeats a bunch of times ... ]

/Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/rails/gem_dependency.rb:277:in `==': undefined method `name' for "actionmailer":String (NoMethodError)
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `==='
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:217:in `matching_specs'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `find_all'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/specification.rb:410:in `each'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/specification.rb:409:in `each'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `find_all'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:216:in `matching_specs'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:238:in `to_specs'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems.rb:1210:in `gem'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/rails/gem_dependency.rb:75:in `add_load_paths'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `each'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:132:in `process'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:113:in `send'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:113:in `run'
    from /Users/username/project/my_app/config/environment.rb:7
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
    from /Users/username/.rvm/gems/ruby-1.8.7-p174@my_app_rails_2/gems/rails-2.3.11/lib/commands/server.rb:84
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /Users/username/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from script/server:3


Yes, RubyGems has had a very fast development pace lately and is not completely backwards compatible. Try:

gem install rubygems -v 1.3.7

You may have to clear out the gemset to reinstall rubygems...

If you're using rvm, you can change the version of RubyGems with the following command:

rvm rubygems 1.3.7
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜