Reputation: 10224
I get this error no such file to load -- mysql2/mysql2
from Passenger in production.
Details about this error /var/www/releases/20120103021152/vendor/cache/ruby/1.9.1/gems/mysql2-0.2.18/lib/mysql2.rb
and it is true, that file doesn't not exist.
Why am I getting this error? How can I fix it?
Upvotes: 4
Views: 8934
Reputation: 391
I've got same error.
rails s
{railsroot}/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require':
cannot load such file -- mysql2/mysql2 (LoadError)
The following has worked.
('{railsroot}/vendor/bundle/ruby/1.9.1/gems/' will depends on your system.)
cd {railsroot}/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/mysql2/ext
ruby extconf.rb
make
make install
cd {railsroot}/vendor/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1/ext/mri
ruby extconf.rb
make
make install
Upvotes: 7
Reputation: 10224
I ended up manually deleting all the gems inside my gems folder and running bundle install. The troublesome gem (a mysql-2.0.18 or something gem version) stopped being installed.
Upvotes: 3
Reputation: 5106
A few things:
Ruby 1.9.1 has many known errors with rails (3+), consider upgrading to 1.9.2.
Did you manually install the mysql2 gem, then add it to your Gemfile? If so, manually uninstall it (All versions) - then run bundle install
Upvotes: 1