dimanche 22 août 2021

Unable to install json version 1.8.2 gem for Ruby version 2.5.3 on Ubuntu 20.04

I am trying to run a rails server and when I run the bundle install command, I get the following error:

An error occurred while installing json (1.8.3), and Bundler cannot
continue.
Make sure that `gem install json -v '1.8.3' --source 'https://rubygems.org/'`
succeeds before bundling.

When I run the recommended command gem install gem install json -v '1.8.3' --source 'https://rubygems.org/', I get error building native extensions

Building native extensions. This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

    current directory: /home/user/.rvm/gems/ruby-2.5.3/gems/json-1.8.3/ext/json/ext/generator
/home/user/.rvm/rubies/ruby-2.5.3/bin/ruby -I /home/user/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0 -r ./siteconf20210822-103903-1kc2ys9.rb extconf.rb
creating Makefile

current directory: /home/user/.rvm/gems/ruby-2.5.3/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /home/user/.rvm/gems/ruby-2.5.3/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function); did you mean ‘mFixnum’?
  861 |     } else if (klass == rb_cFixnum) {
      |                         ^~~~~~~~~~
      |                         mFixnum
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); did you mean ‘mBignum’?
  863 |     } else if (klass == rb_cBignum) {
      |                         ^~~~~~~~~~
      |                         mBignum
generator.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
make: *** [Makefile:242: generator.o] Error 1

make failed, exit code 2

I don't know how do I go about solving this, any help would be much appreciated

Aucun commentaire:

Enregistrer un commentaire