Error installing json Ruby gem Error installing json Ruby gem json json

Error installing json Ruby gem


The issue is arise due to you are not in proper directory. Please go to your rails directory folder first then run this command like this:

rails@rails:~/rails_project/btc$ gem install json -v '1.8.1'

Then its work fine.


This seems to be a common issue with the json 1.8.1 gem. You can use a different version of json if you are declaring it explicitly, but in some cases, json 1.8.1 is a cascading dependency. For instance, you may see something like

In Gemfile:  rails was resolved to 4.1.5, which depends on    actionmailer was resolved to 4.1.5, which depends on      actionpack was resolved to 4.1.5, which depends on        actionview was resolved to 4.1.5, which depends on          activesupport was resolved to 4.1.5, which depends on            json

In this case, you just need to change the top level gem (in this case rails) to a different version. 4.2.6 works.


Finding and updating the gem that is pulling in the JSON gem should work. However, another thing that worked for me was to update the version of JSON being installed.

bundle update json

This worked because it updated JSON to version 1.8.6 which is compatible with newer Rubies.