1

I have a problem that seems very related to that in another post, but I don't understand the solution that was arrived at. I am new to Rails, and have put together a Rails 3 app. I am developing in Windows am trying to deploy it to my (shared) Redhat Linux server via git and capistrano, and using Passenger to serve the pages. The deployment process goes fine, but when I try to look at the webpage I get a Passenger error:

!!! Missing the mysql gem. Add it to your Gemfile: gem 'mysql', '2.8.1'.  

In fact, I have added the corresponding line to my Gemfile, and doing a 'gem list' on the server shows that it is there.

In this post, the user helpfully noted exactly the same problem and observed that the Gemfile.lock has the gem for Windows, i.e.

mysql (2.8.1-x86-mingw32).  

This is exactly the same in my Gemfile.lock, and so I imagine the same issue is happening for me; one can see that this is the gem in vendor/cache and vendor/bundle.

However, I don't understand how the proposed fix from that post is supposed to work. I can edit the mysql line in Gemfile.lock to be mysql (2.8.1), but then I get a different Passenger error that says

Can't find mysql-2.8.1 in any of the sources.

How can I fix this?

Community
  • 1
  • 1

2 Answers2

2

In case someone encounters the same problem, here are some things I did that made it work. I don't understand enough of what was going on to know exactly what did the trick.

First, in the Gemfile, I specified that we wanted both ruby and windows versions of the relevant gems.

gem 'sqlite3-ruby', "~> 1.2.5", :platforms => [:mswin, :ruby_18]

gem 'mysql', "2.8.1", :platforms => [:mswin, :ruby_18]

Then on the production server, after using "cap deploy", I removed the gem mysql-2.81-x86-mingw32 from both vendor/bundle and vendor/cache. My production server lets me 'gem install mysql' and 'gem install sqlite3-ruby' but puts it elsewhere in my home directory; I copied these into vendor/bundle and vendor/cache. I edited the Gemfile.lock to change the line 'mysql (2.8.1-x86-mingw32)' to 'mysql (2.8.1)'. 'bundle install' on the production server then seems to install the linux native gems (at least it says 'building native extensions').

After all this, it seems to work.

0

Run the command bundle install. I'm sure this will fix your issue.

Also, do not edit or move over the Gemfile.lock. Let bundler take care of that.

Chris Ledet
  • 11,458
  • 7
  • 39
  • 47
  • OK, I run bundle install (thought it ran as part of cap deploy, but what the heck). It did appear to do something (it said 'installing with native extensions' for mysql). But I'm still getting the same error from Passenger. – David Williamson Jan 28 '11 at 16:16