2016-12-28 105 views
5

我無法安裝cocoapods。我這樣做:安裝cocoapods時出錯:json-1.8.3和更多版本出錯

gem install cocoapods 

而且我得到所有這些錯誤:

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

    current directory: /usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator 
/usr/local/opt/ruby/bin/ruby -r ./siteconf20161228-19158-1ru87yt.rb extconf.rb 
creating Makefile 

current directory: /usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator 
make "DESTDIR=" clean 

current directory: /usr/local/lib/ruby/gems/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); 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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,\ 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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); 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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,\ 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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)) 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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); 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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,\ 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
/usr/local/Cellar/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)) 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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); 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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,\ 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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); 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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,\ 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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); 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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,\ 
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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) : \ 
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
/usr/local/Cellar/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 /usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection. 
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/json-1.8.3/gem_make.out 

我一直在尋找了很多,我不能找到這些錯誤東西。

我該如何解決這個問題?

回答

5

看來JSON 1.8.3 is not compatible with ruby 2.4.。我認爲他們現在正在解決這個問題。在此期間,我通過降級到紅寶石解決了類似的問題2.3

+0

如果它幫助其他人:'brew switch ruby​​ 2.3.3'(http://stackoverflow.com/a/4158763/1988505)和'sudo gem update --system'(http://stackoverflow.com/a/39775255/1988505)我發現它很有用。 –

0

我遇到了同樣的問題。我從他們的網站安裝了Cocoapods應用程序,這使我可以構建我的應用程序所需的cocoapods(集成Firebase)。

https://github.com/CocoaPods/CocoaPods/issues/6299#issuecomment-269282062

安裝命令行工具似乎爲我工作,但希望破碎的依賴(json1.8.3)將被固定以使該構建正確。

希望這可以幫助您,直到找到更持久的解決方案。

0

同樣的問題,這裏的寶石「GitHub上的頁面」,試圖安裝JSON ..

在降級解決了我的問題用這個紅寶石2.3:

`釀造安裝rbenv紅寶石打造

將rbenv添加到bash中,以便每次打開終端時都會加載它 echo'if rbenv>/dev/null;然後eval「$(rbenv init - )」;網絡連接」 >>〜/ .bash_profile中 源在〜/ .bash_profile

安裝Ruby rbenv安裝2.3.3 rbenv全球2.3.3 紅寶石-v`

來自:https://gorails.com/setup/osx/10.12-sierra