gpt4 book ai didi

ruby - 解决多个版本的rubygems

转载 作者:数据小太阳 更新时间:2023-10-29 07:29:36 28 4
gpt4 key购买 nike

我的机器上安装了多个版本的 ruby​​gems,当我gem list 时,我看到了我所有的 gems,但是当我运行脚本时,我收到类似这样的错误消息

Missing these required gems:
SystemTimer

除了一个版本之外,是否有任何方法可以删除所有版本的 ruby​​gems?理想情况下,我希望能够访问在我的程序中显示在 gem list 下的所有 gem。

来自 gem 环境 - RUBY 可执行文件:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

如果我运行仍然:

$ /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby script/mailer_daemon_fetcher start production
no such file to load -- SystemTimer
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:208:in `load'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `each'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:164:in `process'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
./script/../config/environment.rb:13
script/mailer_daemon_fetcher:5:in `require'
script/mailer_daemon_fetcher:5
no such file to load -- SystemTimer
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:208:in `load'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `each'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:169:in `process'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
./script/../config/environment.rb:13
script/mailer_daemon_fetcher:5:in `require'
script/mailer_daemon_fetcher:5
Missing these required gems:
SystemTimer

You're running:
ruby 1.8.7.72 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
rubygems 1.3.5 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8, /Library/Ruby/Gems/1.8

请注意,在上面我手动调用 ruby​​*/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby** 这与我的 /usr/是同一个文件bin/ruby 是符号链接(symbolic link),并且我的 GEM_PATH 设置为 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

gem 环境的完整输出可在此处获得:http://pastie.org/661104

最佳答案

我认为问题是 SystemTimer 加载有点奇怪,因此您需要在 environment.rb 中进行更多配置

“问题”似乎是 gem 被称为“SystemTimer”,但您需要加载“system_timer”。为了使用 environment.rb 完成此操作,您应该使用:

  config.gem 'SystemTimer', :lib => 'system_timer'

这似乎为我解决了同样的问题。

关于ruby - 解决多个版本的rubygems,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1590288/

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