Mysql2 0.4.0 ruby ​​gem requires an error

I installed mysql2 gem using the command: gem install mysql2

Done installing documentation for mysql2 after 0 seconds
1 gem installed

But when I do require 'mysql2', I get:

LoadError: cannot load such file -- mysql2/mysql2

Although the stone was successfully installed, gem list mysql2

*** LOCAL GEMS ***

mysql2 (0.4.0)

I am using MacOSX with ruby 2.1.5p273

Any suggestions as to where I should look?

+2
source share
2 answers

Are you sure you provided a gem name like this require 'mysql2'? Please show your script.

UPDATE . Looks like a bug in the version mysql2-0.4.0.

If you don’t need this particular version (I doubt it so), just roll back to the previous last stable version in the branch 0.3.x:

ruby-2.1.5 in ~/projects › gem install mysql2 -v '~> 0.3.0'
Fetching: mysql2-0.3.20.gem (100%)
Building native extensions.  This could take a while...
Successfully installed mysql2-0.3.20
1 gem installed
ruby-2.1.5 in ~/projects › irb
>> require 'mysql2'
=> true
>> 
0

-

gem install mysql2 --platform=ruby
0

Source: https://habr.com/ru/post/1607071/


All Articles