Ruby宝石问题(最新进展)

时间:2011-01-04 04:18:30

标签: ruby-on-rails ruby rubygems gem

我对发生的事情感到有点困惑。我的应用程序使用了一些不同的宝石,由于某种原因,存在需要更多宝石的问题。所以举个例子。我在config / environment.rb

中有这个
config.gem 'will_paginate', :version => '2.3.12'
config.gem "bandsintown"
config.gem "gchartrb"

我刚刚添加 gchartrb 。我跑的时候

 rake gems
(in /Users/matt/Sites/someapp)
  - [R] will_paginate = 2.3.12
  - [R] bandsintown 
  - [ ] gchartrb 

 I = Installed
 F = Frozen
 R = Framework (loaded before rails starts)

然后我跑

sudo rake gems:install

gem install gchartrb
Successfully installed gchartrb-0.8
1 gem installed

gem list | grep gchart
gchartrb (0.8)

所以我很困惑该怎么做。我在mac osx上的雪豹。这是我的环境

which gem
 /usr/local/bin/gem
which ruby
 /usr/local/bin/ruby

gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.4.0]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/1.8
     - /Users/matt/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
     - :sources => ["http://gems.rubyforge.org/", "http://gems.github.com", "http://gemcutter.org"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gems.github.com
     - http://gemcutter.org

如果有人知道为什么我似乎无法将任何其他宝石安装到此应用程序中......

这是我的错误

script/server 
=> Booting WEBrick
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
Missing these required gems:
  gchartrb  

You're running:
  ruby 1.8.7.174 at /usr/local/bin/ruby
  rubygems 1.3.7 at /Users/matt/.gem/ruby/1.8, /usr/local/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.

1 个答案:

答案 0 :(得分:5)

这里的问题是gchartrb是gem的名称,但您需要google_chart来加载gem。试试这个

config.gem "gchartrb", :lib => "google_chart"