Rails bundle install has issues with postgres gem - ruby-on-rails

I've been running into issues with pg in my Rails gem. When I try to..
$ bundle install
..my terminal returns..
An error occurred while installing pg (0.21.0), and Bundler cannot
continue.
Make sure that `gem install pg -v '0.21.0'` succeeds before bundling.
My gemfile includes this:
group :production, :default do
gem 'pg'
end
The exercise I am doing is to deploy my Rails app in Heroku, and it works. The idea is that I do not install postgres locally.
This is my Github repo, if it helps: https://github.com/cyqurayte/Rails1

The idea is that I do not install postgres locally.
I don't think it's possible to install this gem without having postgres already installed and updated
The reason this works on heroku is that the environment there already has postgres installed

Related

LoadError issue with rails server

I am new to rails and I am having a problem with starting a web server. After I type in "rails server" in my terminal, I see the following error.
How can I fix this? I tried gem pristine stuff as suggested but it didn't work.
Try gem install bundler and install dependencies.
If bundler is not install, install bundler with command: gem install bundler
Install all gem with command: bundle install or bundle.
Then Configure your database to the database.yml.
Create new database: rake db:create
Then start rails server.
rails server or rails s

AWS - Heroku - Ruby on Rails - Failed to install gems via Bundler

I am running bundle update in the AWS environment but I am getting an error:
An error occurred while installing pg (0.20.0), and Bundler cannot continue.
Make sure that gem install pg -v '0.20.0' --source 'https://rubygems.org/' succeeds before bundling.
I am following the this tutorial. When I run git push Heroku master , it says it failed to install gems via bundler.
Im not sure why I cannot install the gems needed.
Any help or guidance would be greatly appreciated. Thank you
I don't know but i think you should run this step before bundling
gem install pg
Are you trying to deploy to AWS or Heroku?
If it's Heroku:
The pg version's that Heroku uses is: 0.21.0
So, you should put into your Gemfile:
gem 'pg', '0.21.0'
And then commit and push to Heroku
If it's AWS:
You should try just as #Kumar commented on your post...

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.

Rails installation on hostmonster bundle install fails

So I had a rails app up and working on my hostmonster account just fine. I then updated a few things in my dev environment / pushed them up to github / pulled them back down on my production environment. Now its giving me the error Could not find pg-0.17.1 in any of the sources (Bundler::GemNotFound).
This is a new gem i installed in my dev because i was attempting to move to postgresql for dev and live....for now im using postgresql in dev and mysql2 in production. I know this isn't optimal but im working on it.
I tried running bundle install to get the pg gem installed and it fails with the error
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-10.2.2.gem] in /home4/muscorei/workspace/vollapp
An error occurred while installing rake (10.2.2), and Bundler cannot continue.
Make sure that gem install rake -v '10.2.2' succeeds before bundling.
I try installing rake and it works fine...try again..same error. I have found one question on here that seems to fix this for others but it requires running of gem update --system which you cannot do for hostmonster. Any ideas?
So here is another "related" issue. When i type in gem list --local I see that rails is installed at version 4.1.0....however when i do rails -v it shows the systemwide version of 3.2.13. I don't EVER have any of these annoying issues on my dev environment.

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!

Resources