我的 rb 文件很简单,如下所示:
require 'rubygems'
require 'mysql2'
require 'sequel'
Sequel.connect(:adapter => 'mysql2', :database=>'xxx', :user => 'xxx', :password => 'xxxxxx', :host => 'xxxxxxxx.compute-1.amazonaws.com')
当我运行此文件时,出现以下错误:
> /usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require': cannot load such file -- mysql2 (LoadError) from
> /usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require' from t.rb:2:in `<main>'
我在我的亚马逊实例上运行了命令“bundle list”,得到了以下列表:
捆绑包中包含的宝石:* actionmailer (3.2.8) * actionpack (3.2.8) * activemodel (3.2.8) * activerecord (3.2.8) * activeresource (3.2.8) * activesupport (3.2.8) * arel (3.0.2) * builder (3.0.0) * bundler (1.0.21) * coffee-rails (3.2.2) * coffee-script (2.2.0) * coffee-script-source (1.3.3) * erubis (2.7.0) * execjs (1.4.0) * 远足 (1.2.1) * i18n (0.6.0) * 旅程 (1.0.4) * jquery-rails (2.1.1) * json (1.7.5) * mail (2.4.4) * mime-types (1.19) * multi_json (1.3.6) * mysql2 (0.3.11) * polyglot (0.3.3) * rack (1.4.1) * rack-cache (1.2) * rack -ssl (1.3.2) * rack-test (0.6.1) * rails (3.2.8) * railties (3.2.8) * rake (0.9.2.2) * rdoc (3.12) * sass (3.2.1) * sass-rails (3.2.5) * 续集 (3.38.0) * sprockets (2.1.3) * thor (0.16.0) * 倾斜 (1.3.3) * treetop (1.4.10) * tzinfo (0.3.33)
所以我们可以看到有 mysql2 gem。有什么建议吗?
谢谢大家!