我試圖得到了RVM加快。爲什麼應用程序可以在系統環境中正常運行,但不能在RVM下運行?
我有一個Rails 2個應用程序,我的系統中正常工作。換句話說,它在我安裝RVM之前就工作了,如果我「關閉RVM」與$ rvm use system
一起工作。
在RVM我安裝在同一紅寶石版本和補丁級別爲我的系統紅寶石,然後我創建了一個寶石,並安裝所有的應用程序使用的gem版本。
然而,在RVM當我運行rake gems
我得到這樣的結果......
$ 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)
隨着--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/[email protected]_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/[email protected]_app_rails_2/gems/rails-2.3.11/lib/rails/gem_dependency.rb:75:in `add_load_paths'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `each'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:132:in `process'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:113:in `send'
/Users/username/.rvm/gems/[email protected]_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/[email protected]_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/tasks/misc.rake:4
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/username/.rvm/gems/[email protected]_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/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/tasks/gems.rake:17
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/username/.rvm/gems/[email protected]_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/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/username/.rvm/gems/[email protected]_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/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rake-0.9.2/bin/rake:32
/Users/username/.rvm/gems/[email protected]_app_rails_2/bin/rake:19:in `load'
/Users/username/.rvm/gems/[email protected]_app_rails_2/bin/rake:19
Tasks: TOP => environment
當我嘗試運行應用程序,我得到...
$ 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 /Users/username/.rvm/gems/[email protected]_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/[email protected]_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/[email protected]_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/[email protected]_app_rails_2/gems/rails-2.3.11/lib/rails/gem_dependency.rb:75:in `add_load_paths'
from /Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
from /Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `each'
from /Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:301:in `add_gem_load_paths'
from /Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:132:in `process'
from /Users/username/.rvm/gems/[email protected]_app_rails_2/gems/rails-2.3.11/lib/initializer.rb:113:in `send'
from /Users/username/.rvm/gems/[email protected]_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/[email protected]_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
from /Users/username/.rvm/gems/[email protected]_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
from /Users/username/.rvm/gems/[email protected]_app_rails_2/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
from /Users/username/.rvm/gems/[email protected]_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
我有,你有寶石在你的系統安裝和RVM是不同的強烈的感覺,而這導致了錯誤。你可以檢查你在兩個ruby下使用相同版本的rails和rubygems嗎? – Augusto
Rails版本:檢查。個人寶石版本:檢查。系統RubyGems版本:1.3.7。 RVM RubyGems版本:1.8.10。這可能嗎?如果是這樣,我可以在RVM下降級RubyGems嗎? – Ethan
這聽起來**高度可能,特別是因爲stacktrace的第二條頂線來自'gem_dependency.rb'。 RVM上的這個頁面介紹瞭如何使用不同的[RubyGems](http://beginrescueend.com/rubies/rubygems/)版本。 – Augusto