Команда Bundle содержит неправильный самоцвет mysql2 (всегда 0.3.2) - PullRequest
3 голосов
/ 05 мая 2011

Я получил ошибку при попытке запустить консоль $ rails

/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2.rb:8
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:in `require'
    from /Users/ccool2486/Sites/test3mysql/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:21:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:21
    from script/rails:6:in `require'
    from script/rails:6
ccool-2:test3mysql ccool2486$ rails console
WARNING: This version of mysql2 (0.3.2) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `establish_connection': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter) (RuntimeError)
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/railtie.rb:59
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:42:in `each'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/base.rb:1903
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/railtie.rb:32
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `call'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `to_proc'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/railtie.rb:180:in `each'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/railtie.rb:180:in `load_console'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/application.rb:154:in `load_console'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/application/railties.rb:11:in `each'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/application/railties.rb:11:in `all'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/application.rb:154:in `load_console'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands/console.rb:26:in `start'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands/console.rb:8:in `start'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:23
    from script/rails:6:in `require'
    from script/rails:6

Хмм ... поэтому я попытался удалить гем mysql2 и переустановить версию 0.2.7 гем

 sudo gem uninstall mysql2 -i /Library/Ruby/Gems/1.8

И я изменил gemfile:

gem 'mysql2','0.2.7'

Ран Бандлер в каталоге моего приложения:

bundle install

Но он снова установил версию 0.3.2 !!!Может кто-нибудь помочь, я, честно говоря, не знаю, что здесь произошло.

Ответы [ 2 ]

9 голосов
/ 08 мая 2011
sudo gem uninstall mysql2

в Gemfile gem 'mysql2', '< 0.3'

bundle update
0 голосов
/ 01 августа 2012

с вашим

gem 'mysql2','0.2.7'

Попробуйте

bundle update

строит комплект с нуля

...