skip to Main Content

I’m using Ruby 2.4 on Mac Sierra. How do I figure out what Gem is requiring JSON 1.8.3? Although I haven’t specified this gem in my Gmefile, shown below

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'  #, '~> 4.2.7.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'

gem 'uuids'
gem 'addressable'
gem 'postgresql'
gem 'pundit'
gem 'omniauth-oauth2', '~> 1.3.1'
gem 'omniauth-google-oauth2'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-linkedin-oauth2'
gem 'jquery-ui-rails'
gem 'jquery-cookie-rails'
gem 'will_paginate'
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
gem 'compass-rails'
gem 'pdf-reader'
gem 'jquery-turbolinks'
gem 'activerecord-import'
gem 'w3c_validators'
gem 'whenever', :require => false
gem 'roo-xls'
gem 'socksify'

but when I run “bundle install,” I get all these errors related to the JSON gem, that I haven’t specified anywhere.

localhost:myproject davea$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies..........
Using rake 12.0.0
Using Ascii85 1.0.2
Using i18n 0.7.0
Installing json 1.8.3 with native extensions
Using minitest 5.10.1
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 1.6.5
Using mime-types-data 3.2016.0521
Using arel 6.0.4
Using public_suffix 2.0.5
Using afm 0.2.2
Using execjs 2.7.0
Using sass 3.4.23
Using bundler 1.13.7
Using byebug 9.0.6
Using chronic 0.10.2
Using chunky_png 1.3.8
Using coffee-script-source 1.12.2
Using thor 0.19.4
Using multi_json 1.12.1
Using rb-fsevent 0.9.8
Using ffi 1.9.14
Using concurrent-ruby 1.0.4
Using tilt 2.0.5
Using debug_inspector 0.0.2
Using multipart-post 2.0.0
Using hashery 2.1.2
Using hashie 3.4.6
Using turbolinks-source 5.0.0
Using jwt 1.5.6
Using multi_xml 0.6.0
Using oauth 0.5.1
Using ruby-rc4 0.1.5
Using ttfunk 1.4.0
Using pg 0.19.0
Using rubyzip 1.2.0
Using ruby-ole 1.2.12
Using socksify 1.7.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/davea/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator
/Users/davea/.rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20170103-19554-1x7gtyd.rb extconf.rb
creating Makefile

current directory: /Users/davea/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /Users/davea/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c:861:25: error: use of undeclared identifier 'rb_cFixnum'
    } else if (klass == rb_cFixnum) {
                        ^
generator.c:863:25: error: use of undeclared identifier 'rb_cBignum'
    } else if (klass == rb_cBignum) {
                        ^
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
    rb_scan_args(argc, argv, "01", &opts);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
        rb_scan_args0(argc,argvp,fmt,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
                     rb_scan_args_verify(fmt, varc), vars)
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
        verify = rb_scan_args_verify_count(fmt, varc); 
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro    'rb_scan_args_count_hash'
     rb_scan_args_count_block(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro    'rb_scan_args_count_block'
     rb_scan_args_count_end(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro   'rb_scan_args_count_end'
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
    rb_scan_args(argc, argv, "01", &opts);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
        rb_scan_args0(argc,argvp,fmt,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
                     rb_scan_args_verify(fmt, varc), vars)
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
        verify = rb_scan_args_verify_count(fmt, varc); 
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro    'rb_scan_args_count_hash'
     rb_scan_args_count_block(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2163:6: note: expanded from macro    'rb_scan_args_count_block'
     rb_scan_args_count_end(fmt, ofs+1, varc, vari+1))
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro   'rb_scan_args_count_end'
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
    rb_scan_args(argc, argv, "01", &opts);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
        rb_scan_args0(argc,argvp,fmt,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
                     rb_scan_args_verify(fmt, varc), vars)
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
        verify = rb_scan_args_verify_count(fmt, varc); 
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2168:6: note: expanded from macro    'rb_scan_args_count_hash'
     rb_scan_args_count_block(fmt, ofs+1, varc, vari+1))
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro    'rb_scan_args_count_block'
     rb_scan_args_count_end(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro   'rb_scan_args_count_end'
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
    rb_scan_args(argc, argv, "01", &opts);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
        rb_scan_args0(argc,argvp,fmt,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
                     rb_scan_args_verify(fmt, varc), vars)
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
        verify = rb_scan_args_verify_count(fmt, varc); 
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro    'rb_scan_args_count_hash'
     rb_scan_args_count_block(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro    'rb_scan_args_count_block'
     rb_scan_args_count_end(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro   'rb_scan_args_count_end'
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
    rb_scan_args(argc, argv, "01", &opts);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
        rb_scan_args0(argc,argvp,fmt,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
                     rb_scan_args_verify(fmt, varc), vars)
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
        verify = rb_scan_args_verify_count(fmt, varc); 
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro    'rb_scan_args_count_hash'
     rb_scan_args_count_block(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro    'rb_scan_args_count_block'
     rb_scan_args_count_end(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro   'rb_scan_args_count_end'
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generator.c:975:5: warning: division by zero is undefined [-Wdivision-by-zero]
    rb_scan_args(argc, argv, "01", &opts);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2143:9: note: expanded from macro 'rb_scan_args'
        rb_scan_args0(argc,argvp,fmt,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2329:8: note: expanded from macro 'rb_scan_args0'
                     rb_scan_args_verify(fmt, varc), vars)
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2201:11: note: expanded from macro 'rb_scan_args_verify'
        verify = rb_scan_args_verify_count(fmt, varc); 
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2167:6: note: expanded from macro    'rb_scan_args_count_hash'
     rb_scan_args_count_block(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2162:6: note: expanded from macro    'rb_scan_args_count_block'
     rb_scan_args_count_end(fmt, ofs, varc, vari) : 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/davea/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/ruby.h:2158:12: note: expanded from macro   'rb_scan_args_count_end'
    ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings and 2 errors generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/davea/.rvm/gems/ruby-2.4.0/gems/json-1.8.3 for inspection.
Results logged to /Users/davea/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-16/2.4.0/json-1.8.3/gem_make.out

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

How do I figure out what is requiring this gem or how do I fix the errors altogether?

3

Answers


  1. json is required by a couple of gems, including activesupport, which is required by rails.

    As mentioned by jvillan, you can find the dependency tree using gem dependency, more specifically gem dep -R json, bundle viz, or look at the Gemfile.lock.

    To fix this build error, you can try updating Bundler itself and xcode too:

    $ xcode-select --install
    $ sudo chown -R (whoami):admin /usr/local
    $ sudo xcode-select --reset
    $ softwareupdate --install
    $ sudo xcodebuild -license
    

    Then agree or with Apples license.

    Login or Signup to reply.
  2. I faced this problem too and my solution is just fallback Ruby version to 2.3 and wait for all gems to run on 2.4

    Login or Signup to reply.
  3. i had same problem. you need to update to rails 5 and the do bundle again

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search