Why won't bundler install JSON gem?

I get the following error when attempting to run cap production deploy.

DEBUG [dc362284]    Bundler::GemNotFound: Could not find json-1.8.1.gem for installation
DEBUG [dc362284]    An error occurred while installing json (1.8.1), and Bundler cannot continue.
DEBUG [dc362284]    Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

It may be important to note that this deployment was working, than I upgraded to Ruby 2.1.0 to remove an encoding error. I upgraded locally which worked fine. I ran rvm install 2.1.0 and rvm use 2.1.0 then changed my .ruby-version file to reflect this Ruby upgrade.

The bundle install command works locally, but produces the same above error when I ssh onto the destination server and run this command.

If I run gem list I can see this in the list of gems.

...
jquery-rails (3.0.4)
json (1.8.1)
less (2.3.2)
...

If I try the recommended solution gem install json -v '1.8.1' Locally and on the destination server I get the following output:

Building native extensions.  This could take a while...
Successfully installed json-1.8.1
Parsing documentation for json-1.8.1
Done installing documentation for json after 0 seconds
1 gem installed

So it appears the gem is installed, right? Why is this happening? How can I solve this? Any help would be greatly appreciated.


Solution 1:

$ bundle update json
$ bundle install

Solution 2:

So after a half day on this and almost immediately after posting my question I found the answer. Bundler 1.5.0 has a bug where it doesn't recognize default gems as referenced here

The solution was to update to bundler 1.5.1 using gem install bundler -v '= 1.5.1'