没有要加载的文件/缺少这些必需的 gem

No such file to load / Missing these required gems

我有一个 "missing gem" 的问题。 执行 rake gems:install

 >> rake gems:install
(in /some/path)
gem install google-api-client --version "= 0.7.1"
Successfully installed uuidtools-2.1.5
Successfully installed google-api-client-0.7.1
2 gems installed
Installing ri documentation for uuidtools-2.1.5...
Installing ri documentation for google-api-client-0.7.1...
Installing RDoc documentation for uuidtools-2.1.5...
Installing RDoc documentation for google-api-client-0.7.1...

我们可以在 gem 列表中看到 gem

的存在
 >> gem list | grep google
google-api-client (0.7.1)

启动我的铁路应用程序时,我得到一个:

Missing these required gems:
  google-api-client  

You're running:
  ruby 1.8.7.302 at /usr/bin/ruby1.8
  rubygems 1.3.7 at /some/path/.gem/ruby/1.8, /usr/lib/ruby/gems/1.8

然后 Rails 建议我执行 "rake gems:install" 来解决问题..

我只安装了一个 ruby 版本:ruby 1.8.7-p302

 >> which ruby
/usr/bin/ruby

 >> ls -l /usr/bin/ruby
lrwxrwxrwx 1 root root 7 Aug 26  2013 /usr/bin/ruby -> ruby1.8

 >> ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]

 >> gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.8
     - /root/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

不知道问题出在哪里

(同样,如果我只制作一个ruby测试文件

require "rubygems"
require "google-api-client"

它输出相同的错误:

 >> ruby test.rb 
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- google-api-client (LoadError)
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from test.rb:2

)

编辑:我没有在这个应用程序上使用捆绑包。

你有解决这个问题的线索吗?

谢谢!

您将更新包版本,然后更新 gem。

嗯,只是错误的要求

require "google/api_client" 

而不是

require "google-api-client"

感谢您的帮助。