没有加载gem mysql2 gem

时间:2015-09-09 04:20:31

标签: mysql ruby sinatra

我正在努力解决Sinatra中的麻烦。我将ruby更新到2.0.0并完成了我的应用程序的迁移,这些应用程序完全在1.8.3上运行。

捆绑安装完成但我运行时

bundle exec rackup

我有以下错误。如果您有任何解决方案,我将不胜感激。

我正在使用MacOS X 10.10.2,ruby2.0.0

  

捆绑exec rackup   法拉第:: Builder现在是Faraday :: RackBuilder。   /Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/connection_specification.rb:190:in rescue in spec': Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem&#39; mysql2&#39; to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError) from /Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/connection_specification.rb:187:in符合规范&#39;       来自/Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.13/lib/active_record/connection_handling.rb:50:in establish_connection' from /Users/user/Documents/fishingderby/config.ru:21:in阻止&#39;       来自/Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in instance_eval' from /Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in初始化&#39;       来自/Users/user/Documents/fishingderby/config.ru:in new' from /Users/user/Documents/fishingderby/config.ru:in&#39;       来自/Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in eval' from /Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in new_from_string&#39;       来自/Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in parse_file' from /Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:299:in build_app_and_options_from_config&#39;       来自/Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:208:in app' from /Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:336:in wrapped_app&#39;       来自/Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:272:in start' from /Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:147:in start&#39;       来自/Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/bin/rackup:4:in <top (required)>' from /Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/bin/rackup:23:in loading&#39;       来自/Users/user/Documents/fishingderby/vendor/bundle/ruby/2.0.0/bin/rackup:23:in`'

GEMFILE.lock就像这样

GEM
  remote: https://rubygems.org/
  specs:
    activemodel (4.1.13)
      activesupport (= 4.1.13)
      builder (~> 3.1)
    activerecord (4.1.13)
      activemodel (= 4.1.13)
      activesupport (= 4.1.13)
      arel (~> 5.0.0)
    activesupport (4.1.13)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    arel (5.0.1.20140414130214)
    aws_cf_signer (0.1.3)
    backports (3.6.6)
    builder (3.2.2)
    cloudinary (1.1.0)
      aws_cf_signer
      rest-client
    faraday (0.9.1)
      multipart-post (>= 1.2, < 3)
    hashie (3.4.2)
    httparty (0.11.0)
      multi_json (~> 1.0)
      multi_xml (>= 0.5.2)
    i18n (0.6.11)
    json (1.8.3)
    jwt (1.5.1)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    mime-types (1.25.1)
    minitest (5.8.0)
    multi_json (1.11.2)
    multi_xml (0.5.5)
    multipart-post (2.0.0)
    mysql2 (0.4.0)
    oauth (0.4.7)
    oauth2 (1.0.0)
      faraday (>= 0.8, < 0.10)
      jwt (~> 1.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (~> 1.2)
    omniauth (1.2.2)
      hashie (>= 1.2, < 4)
      rack (~> 1.0)
    omniauth-facebook (2.0.1)
      omniauth-oauth2 (~> 1.2)
    omniauth-google-oauth2 (0.2.6)
      omniauth (> 1.0)
      omniauth-oauth2 (~> 1.1)
    omniauth-oauth (1.1.0)
      oauth
      omniauth (~> 1.0)
    omniauth-oauth2 (1.3.1)
      oauth2 (~> 1.0)
      omniauth (~> 1.2)
    omniauth-twitter (1.2.1)
      json (~> 1.3)
      omniauth-oauth (~> 1.1)
    r18n-core (2.0.4)
    rack (1.6.4)
    rack-protection (1.5.3)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rdoc (4.2.0)
      json (~> 1.4)
    rest-client (1.6.8)
      mime-types (~> 1.16)
      rdoc (>= 2.4.2)
    simple_oauth (0.3.1)
    sinatra (1.4.6)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    sinatra-cache (0.3.7)
      sinatra (>= 1.1.0)
      sinatra-outputbuffer (>= 0.1.0)
    sinatra-contrib (1.4.6)
      backports (>= 2.0)
      multi_json
      rack-protection
      rack-test
      sinatra (~> 1.4.0)
      tilt (>= 1.3, < 3)
    sinatra-flash (0.3.0)
      sinatra (>= 1.0.0)
    sinatra-outputbuffer (0.1.0)
      sinatra (>= 1.0.a)
    sinatra-r18n (2.0.4)
      r18n-core (= 2.0.4)
      sinatra (>= 1.3)
    slim (3.0.6)
      temple (~> 0.7.3)
      tilt (>= 1.3.3, < 2.1)
    temple (0.7.6)
    thread_safe (0.3.5)
    tilt (2.0.1)
    twitter (4.8.1)
      faraday (~> 0.8, < 0.10)
      multi_json (~> 1.0)
      simple_oauth (~> 0.2)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)

PLATFORMS
  ruby

DEPENDENCIES
  activerecord
  cloudinary
  httparty (= 0.11.0)
  i18n (= 0.6.11)
  json
  mail
  mime-types (= 1.25.1)
  mysql2
  omniauth-facebook
  omniauth-google-oauth2
  omniauth-twitter
  rest-client (= 1.6.8)
  sinatra
  sinatra-cache
  sinatra-contrib
  sinatra-flash
  sinatra-r18n
  slim
  twitter (= 4.8.1)

BUNDLED WITH
   1.10.6

1 个答案:

答案 0 :(得分:1)

我发现这很有效。

在Gemfile中,指定如下。

gem'mysql2','〜&gt; 0.3.20'

实际安装了mysql2(0.3.20)。

最新mysql2上的任何错误?