我如何找出导致Rails需要JSON 1.8.3的原因?

时间:2017-01-03 23:57:19

标签: ruby-on-rails json ruby ruby-on-rails-4 rubygems

我在Mac Sierra上使用Ruby 2.4。我如何弄清楚Gem需要JSON 1.8.3?虽然我没有在我的Gmefile中指定这个gem,如下所示

# 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'

但是当我运行"捆绑安装时,"我得到了与JSON gem相关的所有这些错误,我还没有在任何地方指定。

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.

我如何弄清楚需要这个宝石的是什么,或者如何完全修复错误?

3 个答案:

答案 0 :(得分:1)

div.sidebyside{ float:left; border: 5px solid #000000; } div#image{ width : 20%; } div#info{ width : 70%; padding-left: 5%; } @media (max-width: 768px) { div#image{ width: 50%; margin-left: 25% ; margin-right: 25% ; } div#info{ width : 100%; padding-left: 0%; } } 是一些宝石所必需的,包括json所需的activesupport

正如jvillan所提到的,您可以使用rails找到依赖关系树,更具体地说是gem dependencygem dep -R json,或者查看bundle viz

要修复此构建错误,您可以尝试更新Bundler本身和xcode:

Gemfile.lock

然后同意或与苹果许可证。

答案 1 :(得分:0)

我也面临这个问题,我的解决方案只是将Ruby版本回退到2.3并等待所有宝石在2.4上运行

答案 2 :(得分:0)

我有同样的问题。你需要更新到rails 5和do bundle