1

你好,

最近的问题真的很困扰我。我一直无法弄清楚它为什么存在。

我有一个Rails 2应用程序,特别Rails 2.3.5是,我试图在运行 Ubuntu 10.10 的开发机器上部署它。据我所知,我已经正确设置了所有内容。这里有一些证据:

ayaz@ubuntu$ rails -v
Rails 2.3.5
ayaz@ubuntu$ gem -v
1.3.7
ayaz@ubuntu$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
ayaz@ubuntu$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /var/lib/gems/1.8
     - /home/ayaz/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/
ayaz@ubuntu$ gem list

*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
atomic (1.1.10)
daemons (1.1.9)
eventmachine (1.0.3)
i18n (0.6.4)
kgio (2.8.0)
minitest (4.7.5)
multi_json (1.7.7)
rack (1.5.2, 1.0.1)
rails (2.3.5)
raindrops (0.11.0)
rake (10.1.0)
thin (1.5.1)
thread_safe (0.1.2)
tzinfo (0.3.37)
unicorn (4.6.3)

如果我通过运行应用程序script/server,它运行良好:

ayaz@ubuntu$ script/server 
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-07-28 01:10:37] INFO  WEBrick 1.3.1
[2013-07-28 01:10:37] INFO  ruby 1.8.7 (2010-06-23) [i686-linux]

但是,如果我通过unicornthin运行它,我会不断收到此gem错误:

ayaz@ubuntu$ thin start
>> Using rails adapter
Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

unicorn_rails给出同样的错误。现在,我环顾四周,发现了有关require "rubygems"预先添加的建议。config/boot.rb我已经尝试过了:我已经在as的顶部添加了这一行config/environment.rb,但无济于事。

请问有人能指点我正确的方向吗?

非常感谢!

4

1 回答 1

0

我希望您运行多个版本的 ruby​​/rubygems(例如通过 RVM 或 rbenv)。这可能会帮助您确定实际使用的是哪个 ruby​​:

which ruby

which gem
于 2014-08-12T16:35:10.393 回答