Can't install JSON gem
Why did you run gem install json
at all? Bundler takes care of that for you and will ensure that the correct version of each gem is installed (since sometimes dependencies require an older version). Run
gem uninstall json
bundle install
Also ensure you have source 'https://rubygems.org'
at the top of your Gemfile.
As for the permissions info, you may have to run gem
and bundle
commands with sudo
.
By the way, I highly recommend taking a look at and using RVM, particularly the gemsets feature. It will make your life infinitely better when developing Ruby apps. If you decide to do so, I'd also suggest trashing all the gems you've install using the system Ruby by running sudo rm -rf /Library/Ruby/Gems/1.8/
. It's also important that when using RVM you don't have to use sudo
when running gem
(or bundle
), which is not only safer but less typing too.
Error installing json 1.8.3 with ruby 2.4
I ran into the same issue recently as well, try and see if there's a newer version of whatever gem you're using that depends on json 1.8.3. This is happening because Ruby 2.4 unified Fixnum and Bignum into Integer. If you're able to upgrade to json 1.8.5 or higher, it should help fix your problems.
You could also try and update the gem you're using and try to relax the version constraints (I've found this to work with a lot of projects, but not all) like so:
gem 'json', '>= 1.8'
Error installing json gem: The 'json' native gem requires installed build tools
There are detailed steps for installing DevKit here:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
And to test that your installation is working correctly, you are supposed to try this:
gem install json --platform=ruby
So, you should already have json installed. Instead of reinstalling ruby, I would try reinstalling DevKit...and follow the directions EXACTLY.
Why am I not able to install JSON gem?
Seems like you have multiple versions of json
installed and the wrong version is being used
Prepending
bundle exec
to your command may solve this.
As the warning suggest you can add bundle exec
before your command. This will make sure to use the Gem versions mentioned in your Gemfile
.
bundle exec jekyll build
and
bundle exec jekyll serve
An error occurred while installing json (1.8.6), and Bundler cannot continue
This can be solved by doing the following
1. Installing the ruby development environment by running the following command(for Linux machines).
sudo apt-get install ruby
ruby -e 'puts RUBY_VERSION[/\d+\.\d+/]' -dev
Read this post for more details.
2. Now install the json -v '1.8.6'
gem by running the following command.
sudo gem install json -v '1.8.6'
This should solve the issue. Now try running bundle update
and bundle install
and it should work fine.
Thanks @TomLord and @Haider Ali for your inputs.
Heroku json gem install fails
Update the Gemlock file and try again...!
Or remove it completely so it can install all the gems from scratch
Ruby JSON gem install error: Ruby 2.4.1, JSON 1.8.6 (Windows 10)
Ruby 2.4 relies on json >= 2.0 and you are attempting to install json 1.8.6. They are incompatible. Ensure the two versions are compatible then retry your operation.
Related Topics
How to Specify a Read Timeout for a Net::Http::Post.New Request in Ruby 2
Could Not Find Rake-10.0.4 in Any of the Sources (Bundler::Gemnotfound)
Stack Level Too Deep When Using Carrierwave Versions
Accessing Variables from Included Files in Ruby
Alphabetize Arabic and Japanese Text That Is in Unicode
Bitwise Operations on Strings with Ruby
Getting Current Line of Code in Ruby
How to Remove Blank Values Params from Query String
What Is the Most Ruby-Ish Way of Accessing Nested Hash Values at Arbitrary Depths
Rails 3.2.8 - How to Get the Week Number from Rails
Error "Undefinded Method "Load_Defaults" " When Trying to Deploy App on Heroku
Ssl_Connect Syscall Returned=5 Errno=0 State=Sslv2/V3 Read Server Hello A
Could Not Find Rake with Bundle Exec
Yielding in an Anonymous Block
How Get Best Performance Rails Requests Parallel Sidekiq Worker
Is There a Solution to Bypass 'Can't Add a New Key into Hash During Iteration (Runtimeerror)'