Bundle install error json gem

2019-08-29 14:34发布

I've got the following problem with ruby on rails v 5.1.6 (Ruby version 2.5.0), the most of the time I try to run the command bundle install on a rails project downloaded from github, I get the following error.

Fetching gem metadata from http://rubygems.org/..........
Using rake 0.8.7z
Using abstract 1.0.0
Using activesupport 3.0.7
Using builder 2.1.2
Using i18n 0.5.0
Using activemodel 3.0.7
Using erubis 2.6.6
Using rack 1.2.8
Using rack-mount 0.6.14
Using rack-test 0.5.7
Using tzinfo 0.3.37
Using actionpack 3.0.7
Using mime-types 1.23
Using polyglot 0.3.3
Using treetop 1.4.14
Using mail 2.2.20
Using actionmailer 3.0.7
Using arel 2.0.10
Using activerecord 3.0.7
Using activeresource 3.0.7

Using addressable 2.3.4
Fetching json 1.8.0
    Installing json 1.8.0 with native extensions
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/daniele/.rvm/gems/ruby-2.5.0/gems/json-1.8.0/ext/json/ext/generator
/home/daniele/.rvm/rubies/ruby-2.5.0/bin/ruby -r ./siteconf20180512-28287-pzwgum.rb extconf.rb
creating Makefile

current directory: /home/daniele/.rvm/gems/ruby-2.5.0/gems/json-1.8.0/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /home/daniele/.rvm/gems/ruby-2.5.0/gems/json-1.8.0/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                               ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast
[-Wint-conversion]
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                    ^
generator.c: In function ‘generate_json’:
generator.c:840:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
     } else if (klass == rb_cFixnum) {
                         ^
generator.c:840:25: note: each undeclared identifier is reported only once for each function it
appears in
generator.c:842: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’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
Makefile:241: set di istruzioni per l'obiettivo "generator.o" non riuscito
make: *** [generator.o] Errore 1

make failed, exit code 2

Gem files will remain installed in /home/daniele/.rvm/gems/ruby-2.5.0/gems/json-1.8.0 for
inspection.
Results logged to
/home/daniele/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/json-1.8.0/gem_make.out

An error occurred while installing json (1.8.0), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.0'` succeeds before bundling.

In Gemfile:
  airbrake was resolved to 3.1.12, which depends on
    json

What Could the error be? How can I fix it? Thanks for helping.

0条回答
登录 后发表回答