Error when running Rails Server on a local copy: Could not find mysql2-0.2.6 in any of the sources. Try running `bundle install` - mysql

I just forked a copy of an app on github and saved it on my computer. When I attempt to run the rails server in the application directory, I get the following error:
Could not find mysql2-0.2.6 in any of the sources
Try running `bundle install`.
Earlier today, however, I installed MySQL 5.1.53 for Mac OS X and supposedly installed it...at least I'm quite certain I did.
Why does terminal come up with this error message even though I'm quite certain I have MySQL already installed on my system?

It's not complaining about MySQL itself, it's complaining about the missing gem.
Just do what the message says, run a bundle install to download and install the gem.

Related

Problem upgrading from mysql 5.7 to 8.0 in a rails app - missing mysql.so files

I upgraded a working Rails app from Mysql 5.7 to 8.0 on my dev machine but it fails to work on a staging/test server setup with the exact same directory structure and env vars.
I'm getting an error "file not found" for /apps/bundle/ruby/2.7.0/gems/mysql2-0.5.4/lib/mysql2/mysql2.so
ldd /apps/bundle/ruby/2.7.0/gems/mysql2-0.5.4/lib/mysql2/mysql2.so shows a file not found (mysql.so.20) (? - I'm not at work so the filenames might be off) that definitely existed and was part of Mysql 5.7.
So the overall question is how to force the mysql2 gem install to relink to the correct new .so files?
There are a lot of moving parts to this, making things a mystery:
installing mysql from a source tarball,
installing in non-standard directories (apps/usr/local/stow/mysql-8.0.16),
using GNU stow to link mysql .so files from the install directory apps/usr/local/stow/mysql-8.0.16 into a common /apps/usr/local/lib directory (the env var LD_LIBRARY_PATH=/apps/usr/local/lib),
vendoring the gems in the bundle on my dev machine using the bundle package --all command so they're part of the git repo.
I've blown away the /apps/bundle directory contents and rerun bundle install thinking that would force a proper linkage of the .so files without success.
Any ideas? TIA!

Stuff not included in RailsReady?

I tried to install RoR on Ubuntu 12.0.4 using RailsReady(https://github.com/joshfng/railsready). Afterwards I restarted my computer and while typing ruby -v works, typing rails -v returns unrecognized, as does mysql in the terminal. What do I have to do to be able to launch rails and mysql? Do I have to install them individually using sudo even though I've already installed RailsReady? Thanks.
A quick glance at the README and the script itself shows that it gets you ready to install Rails by installing typical packages needed in order to create a Rails-based development environment, and then attempts to install it.
Per #madth3's comment below, lines 176 to 182 of railsready.sh does attempt to install Rails, so look for any error messages when you run that script.
MySQL appears to require separate installation using standard methods appropriate for your system.

Ruby (Rack) application could not be started - mysql library error

Bluehost just upgraded their MySql version and broke my application.
I now get "Ruby (Rack) application could not be started" and this specific file load error:
libmysqlclient_r.so.16: cannot open shared object file: No such file or directory - /home4/mychairs/ruby/gems/gems/mysql2-0.3.11/lib/mysql2/mysql2.so
Notice the super long root-based path.
Running
bundle install
via SSH and then
bundle show mysql2
I am told that I am using this library:
/home4/mychairs/ruby/gems/gems/mysql2-0.3.11
I cannot tell where the abnormal path is being generated.
Remove the mysql gem manually and reinstall it via 'bundle install'. Bundler has no idea the underlying MySQL lib has changed, it just knows that the gem is there.

Installing MYSQL and passenger gems, getting no definitions for documentation

I'm running Mac OSX 10.6.4 and setting up rails for the first time. I've been following a bunch of guides to get set up, specifically these two here and here. Also, I know this question has been asked before, but nothing has helped me and my circumstances are a bit different.
First, let me give you my setup.
I've installed Xcode, but I don't want to use the system ruby so, what I did was, I installed RVM and created two gemsets for different ruby versions (1.8.7#rails2.3.8 and 1.9.2#rails3), cause I also want to try rails 3.
I created a global gemset so that I could install passenger and mysql for 1.8.7 and not have to do it for each project. Then set the global gemset by rvm gemset use global
I had already installed MacPorts in a previous step, so what I've done is install mysql using this command sudo port install mysql5 mysql5-server.
Now I run gem install passenger and then passenger-install-apache2-module. This is where I ran into the first issue. Passenger installed fine, but I got "no definition" errors when it tried to install the documentation.
Finally, I want to install the mysql gem so I followed the steps here by adding rvm_archflags="-arch x86_64" to the ~/.rvmc file and then ran export ARCHFLAGS="-arch x86_64" ; gem install mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config Here is where I ran into the issue again. I got a "Successfully installed mysql-2.8.1" message, but all the documentation returned "no definition" errors!
So, why am I getting these errors when installing gems? What can I do to get them installed without errors and ensure future gem installations don't have this problem?
Note: I'm not using sudo because RVM tells you not to.
Here is a link to your problem. They are saying the same thing and the answer is that it's just noise. Obviously something is not right but there is not and should not be a problem. It's most likely that all is fine and documentation was not created, installed, or linked correctly.
http://www.sitepoint.com/forums/showthread.php?t=629077
A -- alone (as written in step 5) usually means to stop reading options. I expect that this is wrong and doesn't belong here or is incomplete (ie, should be --something).

Rails Error - No Such File to Load -- mysql

I've been fighting with a Rails install on my Mac for some time. The error I'm getting (in my development log) says:
Status: 500 Internal Server Error no such file to load -- mysql
Here's some info:
I can successfully rake db:migrate my application.
I've installed the MySQL gem and it appears in the gem list: mysql (2.8.1).
I have Passenger installed.
The error comes from an existing rails app that works on our production server.
Creating a new Rails app, a new MySQL db (using mysqladmin -uroot create sampledb) works fine.
I've googled this and can't find anything specific to this error. There are a few related results where the solutions relate to paths when installing the MySQL gem. For example,
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
Has anyone else experienced this issue or suggest a solution?
Thanks for the response - the good news is, the problem is solved.
The bad news - I'm not entirely sure what fixed it. I can tell you this: it had something to do with the mysql gem install and all the flags pointing to lib, include and config. There are probably a dozen different versions of the same command floating around out there for Mac OS X Leopard.
The odd thing was that ruby appeared to be connected to mysql on some level (it's ability to rake db for example) but broke when actually loading a page.
The gem install string that ended up working was this:
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I'd love some clarification on the how's & why's of this. This worked for me, but doesn't include pointers to the app directory, the lib directory or the include directory.
Do you have multiple ruby installed? Try invoking this command to find out: whereis ruby
Which ruby version is you passenger using? You can check this from your apache or nginx configuration
Is the ruby version passenger is using the same as ruby you are using from the command line?
Is mysql gem installed on that ruby version?
Double check if the mysql bin path is in your $PATH system environment variable. If you execute
*echo $PATH*
there must be displayed something like
*/usr/local/mysql/bin*
You can also type
mysql and then the tab-key twice.
If if this doesn't bring up a list of mysql commands (like mysqladmin etc.) the mysql bin path is not set ccorrectly. You can set it by adding the correct directory to your bash profile file.
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
Please verify up front if
*/usr/local/mysql/bin*
really contains the mysql commands on your Mac. Important: close and reopen the terminal window to make changes work.