Question

I have updated my ruby version to 2.0.0 with RVM. Then installed mysql2 gem

-> % gem install mysql2
Building native extensions.  This could take a while...
Successfully installed mysql2-0.3.13
1 gem installed
Installing ri documentation for mysql2-0.3.13...
Building YARD (yri) index for mysql2-0.3.13...
Installing RDoc documentation for mysql2-0.3.13...

After that I tried to require mysql2 in irb. But it results in below error!

-> % irb
2.0.0p247 :001 > require 'mysql2'
LoadError: cannot load such file -- mysql2/mysql2
    from /home/sayuj/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
    from /home/sayuj/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
    from /home/sayuj/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>'
    from /home/sayuj/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:60:in `require'
    from /home/sayuj/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:60:in `rescue in require'
    from /home/sayuj/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:35:in `require'
    from (irb):1
    from /home/sayuj/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `<main>'

How can I fix it. Please help me on this.

Was it helpful?

Solution

Update your RVM rvm get stable and re-install ruby2

rvm uninstall ruby-2.0.0-p247
rvm install ruby-2.0.0-p247

This will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top