Why won't bundler install JSON gem?
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'
ruby on rails installing JSON ubuntu error
Installing the ruby1.9.1-dev package should fix this for you
sudo apt-get install ruby1.9.1-dev
An error occurred while installing json (1.8.3), and Bundler cannot continue. on Ubuntu
You are missing a libgmp-dev library.
sudo apt-get install libgmp-dev
Error while installing json gem 'mkmf.rb can't find header files for ruby'
Modern era update, as stated by mimoralea:
In case that you are using ruby 2.0 or 2.2 (thanks @patrick-davey).
sudo apt-get install ruby2.0-dev
sudo apt-get install ruby2.2-dev
sudo apt-get install ruby2.3-dev
or, generic way:
sudo apt-get install ruby-dev
or
sudo apt-get install ruby`ruby -e 'puts RUBY_VERSION[/\d+\.\d+/]'`-dev
The first link you’ve posted is exactly your case: there is no ruby development environment installed. Development env is needed to compile ruby extensions, which are mostly written in C
. Proxy has nothing to do with the problem: everything is downloaded fine, just compilation fails.
I would suggest you to install ruby-dev
(ruby-devel
for rpm-based distros) package onto you target machine.
gcc
package might be needed as well.
Try:
$ sudo apt-get install ruby-dev
Or, for Redhat distro:
$ sudo yum install ruby-devel
Or, for [open]SuSE:
$ sudo zypper install ruby-devel
Bundle install error 'error occurred while installing json (1.7.3)'
One part of the problem is due to a change in rb_str_new
.
This is a related issue on their GitHub page: https://github.com/flori/json/issues/229
As I understand it, the contributors decided to not fix this since it works as it should in json 1.8.3. It's recommended that you upgrade to that version. The json gem has a very stable API so backwards compatibility is usually not an issue.
If you are using bundler you should go to your Gemfile
and change version of json to 1.8.3 or higher using gem 'json', '>=1.8.3'
.
How to fix Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5 while server starting
You better install Ruby 2.2.5 for compatibility. The Ruby version in your local machine is different from the one declared in Gemfile.
If you're using rvm:
rvm install 2.2.5
rvm use 2.2.5
else if you're using rbenv:
rbenv install 2.2.5
rbenv local 2.2.5
else if you can not change ruby version by rbenv,
read here
Related Topics
All Possible Permutations of a Given String
Profile a Rails Controller Action
Don't Create View Folder on Rails Generate Controller
How to Convert an Existing Rails 3 Application into an Engine
Deleting Table from Schema - Rails
Best Way to Combine Fragment and Object Caching for Memcached and Rails
How to Delete Specific Characters from a String in Ruby
What Is an Elegant Way in Ruby to Tell If a Variable Is a Hash or an Array
Rails: I Can't Call a Function in a Module in /Lib - What am I Doing Wrong
How to Get an Array with Column Names of a Table
Ruby: What Does the Asterisk in "P *1..10" Mean
Postgresql Gem Pg Was Unable to Install
Unicorn Unable to Write Pid File
Declaring Instance Variables Iterating Over a Hash!
How to Do a Regex Search in Nokogiri for Text That Matches a Certain Beginning