Skip to main content

Bundler And PG Error On Deployment

Rails • Asked by Damian Nelwep

Hi, I followed every step of the deployment but when I get to 'cap production deploy', some errors appear :

01 /home/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:319:in `check_for_activated_spec!'
      01 :
      01 You have already activated bundler 1.17.2, but your Gemfile requires bundler 1.17.3. Since bundler is a default gem, you can either remove your depe…
      01  (
      01 Gem::LoadError
      01 )

It seems like I have a conflict between bundler versions. I tried many things but not one seems to work fine.

Also I get some errors about PostGres connection. If someone could tell me where this can come from, It'd really help!

01 rake aborted!
      01 PG::ConnectionBad: could not connect to server: Connection timed out
      01    Is the server running on host "1.2.3.4" and accepting
      01    TCP/IP connections on port 5432?
      01 /home/deploy/meaw/shared/bundle/ruby/2.6.0/gems/pg-0.18.4/lib/pg.rb:45:in `initialize'
      01 /home/deploy/meaw/shared/bundle/ruby/2.6.0/gems/pg-0.18.4/lib/pg.rb:45:in `new'
      01 /home/deploy/meaw/shared/bundle/ruby/2.6.0/gems/pg-0.18.4/lib/pg.rb:45:in `connect'

Thank you very much in advance and have a sweet day :)


It says the host IP address is "1.2.3.4" so that looks like a misconfiguration in your deploy.rb or the development/production.rb file


No I've just replaced it myself but it display it correctly !

Don't you think I have to setup bundle properly ?


I've solved this before by just logging into the server and updating the gems, then trying to deploy.


I've done it but nothing have changed and I get the same error messages .. :(

gem update

isn't it ?


No, you need to gem update --system to update bundler. The bundler message is not an error, it's just a warning. I get this often but everything works. I think your Gem::LoadError is something else like mismatched ruby versions.

Your post shows Ruby 2.6.1, is that the same version that's installed on your local machine? Have you also set it in the gem file by adding ruby 2.6.1 and have you also created a .ruby-version file and added ruby-2-6-1 to make everything match?

The Postgres error looks like the service isn't running on the server. You can check the status by running sudo service postgresql status on the server. It should print out a bunch of lines, one will say something like 'Active: active (exited) since Tue 2019-06-25 18:12:36 UTC; 1 months 21 days ago'


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.