gpt4 book ai didi

ruby-on-rails - 为什么一个应用程序在系统环境下可以正常运行,但在 RVM 下却不行?

转载 作者:数据小太阳 更新时间:2023-10-29 08:21:17 24 4
gpt4 key购买 nike

我正在努力跟上 RVM 的步伐.

我有一个在我的系统中运行良好的 Rails 2 应用程序。换句话说,它在我安装 RVM 之前有效,如果我使用 $ rvm use system“关闭 RVM”,它也有效。

在 RVM 下,我安装了与我的系统 Ruby 相同的 Ruby 版本和补丁级别,然后我创建了一个 gemset 并安装了应用程序使用的所有 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/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

当我尝试运行该应用程序时,我得到...

$ 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/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

最佳答案

是的,RubyGems 最近的发展速度非常快,并且不完全向后兼容。尝试:

gem install rubygems -v 1.3.7

您可能必须清除 gemset 才能重新安装 ruby​​gems...

如果您使用的是 rvm,则可以使用以下命令更改 RubyGems 的版本:

rvm rubygems 1.3.7

关于ruby-on-rails - 为什么一个应用程序在系统环境下可以正常运行,但在 RVM 下却不行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7547310/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com