Error updating nokogiri and autoprefixer using Capistrano -- local/production gem mismatch
I've been using Capistrano to deploy my rails app and I've come across an issue trying to update 2 gems. Below at the bottom is the message I get for nokogiri. The other gem I'm trying to update on production is autoprefixer-rails. I basically get the same message when trying cap production deploy. On the production server I see under (/shared/bundle/ruby/2.3.0/gems) it says the version of nokogiri is 1.6.8 and locally I have 1.6.8.1.
The Gemfile and Gemfile.lock versions are correct on github and repo is fully up to date but when I do the cap production deploy I get this error that shows a mismatch between my development machine and the production server.
How do I go about updating these Gems on production? Everything has been working correctly up until the latest updates to autoprefixer and nokogiri.
fails at bundler:install --
Your bundle is locked to nokogiri (1.6.8.1), but that version could not be found
in any of the sources listed in your Gemfile. If you haven't changed sources,
that means the author of nokogiri (1.6.8.1) has removed it. You'll need to
update your bundle to a different version of nokogiri (1.6.8.1) that hasn't been
removed in order to install.
Hey Lance,
Interesting problem, I haven't actually run into this before. What does your Gemfile and Gemfile.lock look like for Nokogiri?
Hi Chris,
In the Gemfile - gem 'nokogiri', '~> 1.6', '>= 1.6.8.1'
In the Gemfile.lock - nokogiri (1.6.8.1)
To get deployment to work again I had to revert back setting nokogiri and autoprefixer-rails back to the previous versions.
For nokogiri I now have it set to - gem 'nokogiri', '1.6.8' in the Gemfile and autoprefixer-rails set to gem 'autoprefixer-rails', '6.5.0.1'
Yeah I'm not sure why the Gems aren't being updated to the versions that match my Gemfile and Gemfile.lock from Github.
Is there anything you might try on production or locally to get things synced up again?
It looks like someone else is experiencing the same issue. I still haven't been able to figure it out.
Super interesting bug there, especially since you aren't the only one. Potentially you need to upgrade your version of bundler? Let me know when you figure out a solution!
Hi Chris,
Thanks for pointing me in the right direction. Once I put gem 'bundler', '~> 1.13', '>= 1.13.2' into my Gemfile and ran bundle update, pushed to github and then ran cap production deploy everything worked properly.
I didn't realize I specifically needed bundler in the Gemfile. I just thought based on the Gemfile.lock file that since it was using bundler 1.13.2 that production would use the same but I guess not.
Anyway, thanks for the help. Thanks for creating this amazing resource. Awesome work man!
I'm kind of surprised that worked, but I guess there was something going on between the versions of Bundler that were local and previously installed in production. We both learned something new today. :) I'll have to keep this in mind as I'm sure I'm going to run into this as well sometime soon I bet.
And thanks man! Doing what I can, but it's just as much you and everyone else in the community who keeps it going, so thank you! 🙌