Search code examples
rubyruby-on-rails-4rvmcapistrano3pg

pg gem upgraded 0.19 to 0.20 - LoadError: incompatible library version


I'm using Capistrano 3 to manage my deployments to AWS, developing on OS X and serving on Ubuntu.

I continue to run into the following issue whenever I upgrade my Gemfile and bundle:

  01 rake aborted!
  01 LoadError: incompatible library version - /var/www/<app_name>/shared/bundle/ruby/2.3.0/gems/pg-0.20.0/lib/pg_ext.so
  01 /var/www/<app_name>/shared/bundle/ruby/2.3.0/gems/pg-0.20.0/lib/pg.rb:4:in `require'
  01 /var/www/<app_name>/shared/bundle/ruby/2.3.0/gems/pg-0.20.0/lib/pg.rb:4:in `<top (required)>'
  01 /usr/local/rvm/gems/ruby-2.3.3@global/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `require'
  01 /usr/local/rvm/gems/ruby-2.3.3@global/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
  01 /usr/local/rvm/gems/ruby-2.3.3@global/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
  01 /usr/local/rvm/gems/ruby-2.3.3@global/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
  01 /usr/local/rvm/gems/ruby-2.3.3@global/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
  01 /usr/local/rvm/gems/ruby-2.3.3@global/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
  01 /usr/local/rvm/gems/ruby-2.3.3@global/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
  01 /var/www/<app_name>/releases/20170406223132/config/application.rb:7:in `<top (required)>'
  01 /var/www/<app_name>/releases/20170406223132/Rakefile:4:in `require'
  01 /var/www/<app_name>/releases/20170406223132/Rakefile:4:in `<top (required)>'
  01 /var/www/<app_name>/shared/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
  01 (See full trace by running task with --trace)

I don't even know where to begin to troubleshoot this. Is this a problem with RVM? Is this a problem with bundler? My app?

I've tried the suggestions found on this RVM issue but to no avail. Suggestions please?

Also, if there's a way to manage this using Capistrano, that'd be preferable, as the purpose of Capistrano is remote system management. But if I have to log into the server, I will - I just don't see why I should have to.

Update - I've gone so far as to completely destroy the RVM gemset and get it to try to fully "reinstall" all gems - still results in the same error as below.


Solution

  • This kind of error usually means that there is something wrong with PostgreSQL versions installed on your target machine - either the are too old or they are somehow incompatible.