`block in replace_gem': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter`

在执行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-adapter`

时间: 2024-11-05 15:00:05

`block in replace_gem': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter`的相关文章

Gem install Mysql2的问题

运行 'bundle install' 或者 'gem install mysql2′ 遇到如下错误 > gem install mysql2 ERROR: Error installing mysql2: The 'mysql2' native gem requires installed build tools. Please update your PATH to include build tools or download the DevKit from 'http://rubyins

bundle install 出现 &amp;#39;gem install mysql2 -v &amp;#39;0.3.15&amp;#39; succeeds before bunding &amp;#39;

bundle install 出现  'gem install mysql2 -v '0.3.15' succeeds before bunding ' 解决:sudo apt-get install libmysql-ruby '如果你找不到包尝试以下的包 參考:http://packages.ubuntu.com/search?keywords=mysql-ruby ruby-dataobjects-mysql libmysqldb-ruby ruby-dbd-mysql sudo apt-

bundle install 出现 &#39;gem install mysql2 -v &#39;0.3.15&#39; succeeds before bunding &#39;

bundle install 出现  'gem install mysql2 -v '0.3.15' succeeds before bunding ' 解决:sudo apt-get install libmysql-ruby '若找不到这个包试试下面到包 参考:http://packages.ubuntu.com/search?keywords=mysql-ruby ruby-dataobjects-mysql libmysqldb-ruby ruby-dbd-mysql sudo apt-

windows rails new demo时候出错Make sure that `gem install mysql2 -v &#39;0.3.15&#39;` succeeds before bundling.

rails new demo --database=mysql最后报错Gem files will remain installed in D:/BillFiles/rails_dev/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.15 for inspection.Results logged to D:/BillFiles/rails_dev/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9

rubygem 国内镜像 解决gem install rails 连接超时的问题

为什么有这个? 由于国内网络原因(你懂的),导致 rubygems.org 存放在 Amazon S3 上面的资源文件间歇性连接失败.所以你会与遇到 gem install rack或 bundle install 的时候半天没有响应,具体可以用 gem install rails -V 来查看执行过程. 这是一个完整 rubygems.org 镜像,你可以用此代替官方版本,同步频率目前为15分钟一次以保证尽量与官方服务同步. 如何使用? $ gem sources --remove https

The sandbox is not in sync with the Podfile.lock. Run &#39;pod install&#39; or update your CocoaPods install

I. Project Cleanup In the project navigator, select your project Select your target Remove all libPods*.a in  Linked Frameworks and Libraries II. Update CocoaPods Launch Terminal and go to your project directory. Update CocoaPods using the command  p

sudo gem install cocoapods 没反应问题

1. 尝试更新 sudo gem update --system 2. 查看安装详细 sudo gem install cocoapods -V 3.详细使用有个链接 http://blog.csdn.net/meegomeego/article/details/24005567

gem install json失败

# gem install json -v '1.8.3' Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `requir

gem install走代理,速度刚刚的

有个树莓pi,安装了shadowsocks 和 cow ,做代理,走ipv6,学校不收ipv6流量钱.速度也不错,快的下载可达10M/s. gem install xx遇到墙了. nano ~/.gemrc