`block in replace_gem': Please install the mysql2 adapter: `gem install activerecord-mysql2-adap
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了`block in replace_gem': Please install the mysql2 adapter: `gem install activerecord-mysql2-adap相关的知识,希望对你有一定的参考价值。
在执行rails s时出现“`block in replace_gem‘: Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter`”错误:
[email protected]:/var/www/ashelf$ rails s => Booting WEBrick => Rails 3.2.22.1 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/rubygems_integration.rb:314:in `block in replace_gem‘: Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (can‘t activate mysql2 (~> 0.3.10), already activated mysql2-0.4.2. Make sure all dependencies are added to Gemfile.) (LoadError) from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activerecord-3.2.22.1/lib/active_record/connection_adapters/mysql2_adapter.rb:3:in `<top (required)>‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/dependencies.rb:251:in `require‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/dependencies.rb:251:in `block in require‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/dependencies.rb:236:in `load_dependency‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/dependencies.rb:251:in `require‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activerecord-3.2.22.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activerecord-3.2.22.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activerecord-3.2.22.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activerecord-3.2.22.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activerecord-3.2.22.1/lib/active_record/railtie.rb:88:in `block (2 levels) in <class:Railtie>‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/lazy_load_hooks.rb:25:in `each‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/lazy_load_hooks.rb:25:in `on_load‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activerecord-3.2.22.1/lib/active_record/railtie.rb:80:in `block in <class:Railtie>‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/initializable.rb:30:in `instance_exec‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/initializable.rb:30:in `run‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/initializable.rb:55:in `block in run_initializers‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/initializable.rb:54:in `each‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/initializable.rb:54:in `run_initializers‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/application.rb:136:in `initialize!‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/railtie/configurable.rb:30:in `method_missing‘ from /var/www/ashelf/config/environment.rb:5:in `<top (required)>‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/dependencies.rb:251:in `require‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/dependencies.rb:251:in `block in require‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/dependencies.rb:236:in `load_dependency‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/activesupport-3.2.22.1/lib/active_support/dependencies.rb:251:in `require‘ from /var/www/ashelf/config.ru:3:in `block in <main>‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize‘ from /var/www/ashelf/config.ru:in `new‘ from /var/www/ashelf/config.ru:in `<main>‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/rack-1.4.7/lib/rack/server.rb:200:in `app‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/commands/server.rb:46:in `app‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/rack-1.4.7/lib/rack/server.rb:254:in `start‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/commands/server.rb:70:in `start‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/commands.rb:55:in `block in <top (required)>‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/commands.rb:50:in `tap‘ from /home/diudiugirl/.rvm/gems/ruby-2.3.0/gems/railties-3.2.22.1/lib/rails/commands.rb:50:in `<top (required)>‘ from script/rails:6:in `require‘ from script/rails:6:in `<main>‘
解决方法:
在Gemfile中加入:
gem ‘mysql2‘
gem ‘activerecord-mysql2-adapter‘
再执行bundle install 即可。
以上是关于`block in replace_gem': Please install the mysql2 adapter: `gem install activerecord-mysql2-adap的主要内容,如果未能解决你的问题,请参考以下文章
Using ffmpeg libraries in Code::Blocks
Moving From Top To Bottom in Detailed Block in Oracle Forms
手动修复 under-replicated blocks in HDFS
Code block of anonymous object in Java
错误:__tcp_connection_write_eof_block_invoke 写入关闭回调收到错误 - iOS 10