An error occurred while installing json (1.8.1), and Bundler cannot continue.

How to Fix “Not able to install gem json -v ‘1.8.1’”

Install json gem on Ubuntu

There might be a case, when you install bundler using apt-get repository of ubuntu, it might not install the latest version of bundler. This may result in error while installing few gems. Below is one of the case:
 
If you have some gems defined in your Gemfile that have dependency over json gem, then while running 

$ bundle install
 
you may encounter following error:
 
DEBUG [gk760254] An error occurred while installing json (1.8.1), and Bundler cannot continue.
DEBUG [gk760254] Make sure that `gem install json -v ‘1.8.1’` succeeds before bundling.
 
 
Run the following command to fix the issue:

$ bundle update
$ bundle install
 
First command will update the version of bundle which will solve the error and you will be able to install all required gems successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *