Error installing json 1.8.3 with ruby ​​2.4

[version information]

ruby 2.4.0p0 (version 2016-12-24 57164) [x86_64-linux] / gem 2.0.3 / Windows 10

I ran bundle install and I was asked to run gem install json -v '1.8.3'

I did this and got the error "Error building internal gem error".

 Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension. /home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb creating Makefile make compiling generator.c generator.c: In function 'generate_json': generator.c:861:25: error: 'rb_cFixnum' undeclared (first use in this function) } else if (klass == rb_cFixnum) { ^ generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in generator.c:863:25: error: 'rb_cBignum' undeclared (first use in this function) } else if (klass == rb_cBignum) { ^ generator.c: At top level: cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default] cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default] cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default] cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default] make: *** [generator.o] Error 1 Gem files will remain installed in /home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3 for inspection. Results logged to /home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out 

I checked several documents. I installed Devkit and json 1.8.5, but my project contains the message "install json 1.8.3", How can I solve this problem?

/home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3 contains:

 ../ ./ data/ diagrams/ ext/ java/ lib/ tests/ tools/ install.rb* .gitignore .travis.yml CHANGES COPYING COPYING-json-jruby GPL Gemfile README-json-jruby.markdown README.rdoc Rakefile 

/home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out contains:

 user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out /home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb creating Makefile make compiling generator.c generator.c: In function 'generate_json': generator.c:861:25: error: 'rb_cFixnum' undeclared (first use in this function) } else if (klass == rb_cFixnum) { ^ generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in generator.c:863:25: error: 'rb_cBignum' undeclared (first use in this function) } else if (klass == rb_cBignum) { ^ generator.c: At top level: cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default] cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default] cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default] cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default] make: *** [generator.o] Error 1 
+19
source share
7 answers

Recently, I ran into the same problem, try and see if there is a newer version of any gem that you use, which depends on json 1.8.3. This is because Ruby 2.4 is unified by Fixnum and Bignum in Integer . If you can upgrade to json 1.8.5 or higher, this should help fix your problems.

You can also try updating the stone you are using and trying to soften version restrictions (I found this works with a lot of projects, but not all):

 gem 'json', '>= 1.8' 
+16
source

Try removing Gemfile.lock and running the bundle command again. It should use a different version of json (i.e. 1.8.6) without problems.

+17
source

In Gemfile.lock

 json (~>1.8.3) 

then do

 bundle update 
+1
source

I forced json 1.8.5 and changed the entry in Gemfile.lock, it seems to be working now.

0
source

I ran into the same problem. Possible solution - we must first remove json from gem

 "gem uninstall json" 

and then install

 "sudo bundle install" 

Remember to add sudo. Without sudo, it cannot install.

0
source

I followed these steps: paste the above command into gemfile (gem 'json', '> = 1.8') and with an error event when the package starts. I have implemented a package update and installed dependencies.

0
source

You must change the line starting with "json" in Gemfile.lock, the next line

json (~>1.8.3)

0
source

Source: https://habr.com/ru/post/1264427/


All Articles