Error in running rails server - ruby-on-rails

I got this error
Could not find mysql2-0.3.13 in any of the sources
Run `bundle install` to install missing gems.
I tried to gem install mysql2 but without luck, it didn't fix it. I'm using wampp server and copied the libmysql.ddl to the bin folder of ruby. I also tried adding the path to the gem install just like this.
gem install mysql2 --platform=ruby -- ‘-with-mysql-lib=”C:\wamp\bin\mysql\mysql5.5.24\lib” -with-mysql-include=”C:\wamp\bin\mysql\mysql5.5.24\include”‘
Any ideas on how to fix this? THanks!

First, make sure you have mysql installed on your machine.
If you have an Ubuntu distribution, try:
sudo apt-get install libmysql-ruby libmysqlclient-dev
then try to install the gem again.

I installed mysql2 from sources like this
# i experienced some troubles with mysql2 0.3.13 installing
gem fetch mysql2 -v 0.3.12
gem install mysql2-0.3.12.gem -- ' --with-mysql-include="c:\Program Files (x86)\MariaDB 5.5\include\mysql" --with-mysql-lib="c:\Program Files (x86)\MariaDB 5.5\lib" '
But after each Gemfile updating and bundle install, bundler is installing precompiled version of mysql2 gem and it's very annoying. After manual removing precompiled gem rails app started successfully
P.S. You also need installed Ruby DevKit.

Related

Running bundle install with modifier on certain gem

I'm trying to work on a project that uses the mysql2 gem, version 0.3.17 specifically.
I can get this to install by running:
gem install mysql2 -- --with-mysql-dir=C:\mysql\connector -v '0.3.17'
However after doing this (in the projects directory), and then run bundle install, it fails with the message
An error occurred while installing mysql2 (0.3.17), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.17'` succeeds before bundling.
Is there any way to run something like
bundle install -- --with-mysql-dir=C:\mysql\connector -v '0.3.17'
? I'm guessing I would need to specifiy the mysql2 gem in the command but I've looked on http://bundler.io/v1.3/man/bundle-install.1.html and can't seem to find anything.
My other option would be to simply point it to the gem I've already installed if that's possible.
Thanks in advance.

I git cloned a repo and I cannot run it on localhost because missing gem and cannot bundle install

I git cloned a repo. I cannot run it on localhost with rails server because terminal says
Could not find activesupport-4.2.5 in any of the sources Run bundle
install to install missing gems.
When I run bundle install, I get
An error occurred while installing pg (0.18.4), and Bundler cannot
continue. Make sure that gem install pg -v '0.18.4' succeeds before
bundling.
I have rails 4.2.3, and the repo's Gemfile has gem 'rails', '4.2.5'. I don't know if this matter
Gem pg is Postgres driver, it only can be installed, if corresponding headers and libraries are present and can be accessed.
Most probably just installing postgres will fix it. If you're on a Mac with homebrew - brew install postgresql
Install postgresql.
Remove Gemfile.lock
Add gem 'pg' in your gemfile
execute bundle install
1: Remove Gemfile.lock if Gemgile.lock present in your project
2: add gem 'pg' # in Gemfile
3: Run bundle install
Hope this help you !!!
Run
sudo env ARCHFLAGS="-arch x86_64" gem install pg -v '1.18.4'
Now try running bundle install again.
I used a combination of #Chakreshwar Sharma and #Vinay's answers to get this working for the metasploit-framework.
Remove Gemfile.lock
Add gem 'pg' in your gemfile
Run apt-cache search postgresql-server-dev
apt-get update && apt-get install postgresql-server-dev-9.5 # Check your version
bundle install --no-deployment
To be honest, I think you could just run:
apt-cache search postgresql-server-dev
apt-cache search postgresql-server-dev-9.5
bundle install
...and you can avoid messing with the Gemfile, but I didn't get to verify it since mine started working after I made the adjustments.

Could not find a valid gem 'mysql2-0.3.18.gem'

i am new to Ruby on rails and i have facing this problem during Rails installation. I have searched a lot and tried many solution which were available on stackoverflow but nothing work for me. Please help how can i get out of this problem..
I have had this problem before, and the reason you are getting this method, is because you are trying to download from an https website.
My guess is you are trying to install all the gems in your gemfile and bundle install didn't work. It would give you a message like
bundler cannot continue. Please make sure gem install samplegem succeeds
Change the following line in your gemfile
source 'https://rubygems.org'
to
source 'http://rubygems.org'
and run bundle
alternatively, you could do the following
gem install mysql2 -s http://rubygems.org
Either way, you should be able to install the gem.
Had you already installed mysql in your machine? The same experiencing happened with me. I was using a virtual environment and trying to install gem mysql2 but I forget that I haven't mysql in my "main" environment.
I ran the following and mysql2 installed successfully.
gem install mysql2 -s http://rubygems.org
But the problem remaied the same when re ran the "bundle install"

Bundler won't install mysql2

First of all I've gone through dozens of posting here on SO and google and haven't been able to find an answer.
I'm trying to install mysql2 with bundler and it won't do it.
Running on Ubuntu Server 11.04 Natty
Here's some background info:
ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
gem -v
1.8.24
rails -v
Rails 3.2.5
$ mysql --version
mysql Ver 14.14 Distrib 5.1.62, for debian-linux-gnu (x86_64) using readline 6.2
I have gem "mysql2", "~> 0.3.11" in my Gemfile
When I do bundle install it goes through the process and it finishes successfully (No Errors) but it doesn't install mysql2. When I do bundle show, mysql2 is not listed.
I've tried a gazillion of things recommended here and on forums and still can't get mysql2 to install with bundler.
Any ideas?
Thanks.
For mysql2 you need to install the dev files on your server.
try first:
sudo apt-get install libmysqlclient-dev
Then check first your GemFile in your RoR App Dir - I have this line in my GemFile:
gem 'mysql2', '0.3.11'
run bundle:
bundle install
or try the command from Emily first then run bundle install:
gem install mysql2 -v=0.3.11
bundle install
I hope it helps
So after many tries, reading, and pulling my hair out I found out what was the problem, so I'm posting it for those that might run into the same situation.
The reason why bundler wouldn't install mysql2 is because the gem was inside this platforms structure, see below:
platforms :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "0.3.11"
end
end
So all I did was to move just gem "mysql2", "0.3.11" by itself to the top of the Gemfile and run bundle install and that did it! Now mysql2 is listed under bundle show and my rails application is running now.
Thanks every one that tried to help!

Installing mysql2 gem for Ruby on Rails 3.1.0

I get this error
Gem files will remain installed in
/home/mark/.bundler/tmp/28288/gems/mysql2-0.2.17 for inspection.
Results logged to
/home/mark/.bundler/tmp/28288/gems/mysql2-0.2.17/ext/mysql2/gem_make.out
An error occured while installing mysql2 (0.2.17), and Bundler cannot
continue. Make sure that gem install mysql2 -v '0.2.17' succeeds
before bundling.
With a Ruby on Rails application and I can not solve it.
Most folks find this works:
sudo apt-get install libmysql-ruby libmysqlclient-dev
It's probably a compilation error. Maybe you don't have mysql development libs installed in your system.
I need to see the logs to make sure.
Try it and paste the output here:
cat /home/mark/.bundler/tmp/28288/gems/mysql2-0.2.17/ext/mysql2/gem_make.out
Btw: wich operation system are you using?

Resources