代码之家  ›  专栏  ›  技术社区  ›  Geeocode

解析bundler-json 1.8.0。Ruby中的不兼容性

  •  0
  • Geeocode  · 技术社区  · 7 年前

    我试过了 bundle install

    我尝试了很多方法,我在这里和那里都找到了:

    • 我试过用sudo和不用sudo,
    • 我尝试了捆绑更新,

    请注意,我在这方面相对较新 红宝石

    sudo bundle install
    Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
    application for all non-root users on this machine.
    Fetching gem metadata from https://rubygems.org/.........
    rails (3.2.14) has dependency bundler (~> 1.0), which is unsatisfied by the current bundler version 2.0.1, so the dependency is being ignored
    Using rake 10.1.0
    Using clive 1.2.0
    Using process_runner 0.0.2
    Using rake-compiler 0.9.1
    Using timers 1.1.0
    Using celluloid 0.14.1
    Using contextual_exceptions 0.0.2
    Using bundler 2.0.1
    Using methadone 1.3.0
    Using i18n 0.6.5
    Using multi_json 1.7.9
    Using activesupport 3.2.14
    Using builder 3.0.4
    Using activemodel 3.2.14
    Using erubis 2.7.0
    Using journey 1.0.4
    Using rack 1.4.5
    Using rack-cache 1.2
    Using rack-test 0.6.2
    Using hike 1.2.3
    Using tilt 1.4.1
    Using sprockets 2.2.2
    Using actionpack 3.2.14
    Using mime-types 1.23
    Using polyglot 0.3.3
    Using treetop 1.4.14
    Using mail 2.5.4
    Using actionmailer 3.2.14
    Using arel 3.0.2
    Using tzinfo 0.3.37
    Using activerecord 3.2.14
    Using activeresource 3.2.14
    Using awesome_print 1.1.0
    Using coderay 1.0.9
    Using better_errors 0.9.0
    Using debug_inspector 0.0.2
    Using binding_of_caller 0.7.2
    Using rack-ssl 1.3.3
    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/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.0/ext/json/ext/generator
    /home/vagrant/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20190205-9598-qp91k4.rb extconf.rb
    creating Makefile
    
    current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.0/ext/json/ext/generator
    make "DESTDIR=" clean
    
    current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.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));
                        ^
    Makefile:238: recipe for target 'generator.o' failed
    make: *** [generator.o] Error 1
    
    make failed, exit code 2
    
    Gem files will remain installed in /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.0 for inspection.
    Results logged to
    /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/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' --source 'https://rubygems.org/'` succeeds before bundling.
    
    In Gemfile:
      blueprint-rails was resolved to 0.2.0, which depends on
        railties was resolved to 3.2.14, which depends on
          rdoc was resolved to 3.12.2, which depends on
            json
    vagrant@vagrant:~/
    

    任何帮助都将不胜感激。

    更新1:

    bundle update json
    Fetching gem metadata from https://rubygems.org/.........
    Fetching gem metadata from https://rubygems.org/.
    Resolving dependencies...
    Bundler could not find compatible versions for gem "bundler":
      In Gemfile:
        methadone was resolved to 1.3.0, which depends on
          bundler
    
        rails (~> 3.2) was resolved to 3.2.14, which depends on
          bundler (~> 1.0)
    
      Current Bundler version:
        bundler (2.0.1)
    This Gemfile requires a different version of Bundler.
    Perhaps you need to update Bundler by running `gem install bundler`?
    
    Could not find gem 'bundler (~> 1.0)', which is required by gem 'rails (~> 3.2)', in any of the sources.
    

    更新2:

    gem uninstall bundler
    
    Select gem to uninstall:
     1. bundler-1.0.10
     2. bundler-2.0.1
     3. All versions
    > 2
    
    You have requested to uninstall the gem:
        bundler-2.0.1
    
    rails-5.2.2 depends on bundler (>= 1.3.0)
    rails-dom-testing-2.0.3 depends on bundler (>= 1.3, development)
    If you remove this gem, these dependencies will not be met.
    Continue with Uninstall? [yN]
    

    sudo bundle update json
    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 10.1.0
    Using clive 1.2.0
    Using process_runner 0.0.2
    Using timers 1.1.0
    Using contextual_exceptions 0.0.2
    Using bundler 1.14.6
    Using i18n 0.6.5
    Using multi_json 1.7.9
    Using builder 3.0.4
    Using erubis 2.7.0
    Using journey 1.0.4
    Using rack 1.4.5
    Using hike 1.2.3
    Using tilt 1.4.1
    Using mime-types 1.23
    Using polyglot 0.3.3
    Using arel 3.0.2
    Using tzinfo 0.3.37
    Using awesome_print 1.1.0
    Using coderay 1.0.9
    Using debug_inspector 0.0.2
    Using json 1.8.6 (was 1.8.0)
    Using thor 0.18.1
    Using sass 3.2.10
    Using callsite 0.0.11
    Using mini_portile 0.5.1
    Using chunky_png 1.2.8
    Using client_side_validations 3.2.6
    Using moped 1.4.5
    Using origin 1.0.11
    Using coffee-script-source 1.6.3
    Using haml 3.1.8
    Using fssm 0.2.10
    Using connection_pool 1.1.0
    Using daemon_controller 1.1.5
    Using daemons 1.1.9
    Using diff-lcs 1.2.4
    Installing eventmachine 1.0.3 with native extensions
    Using god 0.13.2
    Using kramdown 1.1.0
    Using metaclass 0.0.1
    Using redis 3.0.4
    Using require_reloader 0.2.0
    Using rspec-core 2.14.5
    Using rspec-mocks 2.14.3
    Using yard 0.8.7
    Using rake-compiler 0.9.1
    Using celluloid 0.14.1
    Using methadone 1.3.0
    Using activesupport 3.2.14
    Using execjs 1.4.0
    Using rack-cache 1.2
    Using rack-test 0.6.2
    Using rack-ssl 1.3.3
    Using rack-contrib 1.1.0
    Using sprockets 2.2.2
    Using treetop 1.4.14
    Using better_errors 0.9.0
    Using binding_of_caller 0.7.2
    Using rdoc 3.12.2
    Using zen-grids 1.4
    Using nokogiri 1.6.0
    Using oily_png 1.1.0
    Using compass 0.12.2
    Using passenger 4.0.10
    Using rspec-expectations 2.14.1
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
        current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/eventmachine-1.0.3/ext
    /home/vagrant/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20190205-23731-qe1gp5.rb extconf.rb
    checking for main() in -lssl... yes
    checking for main() in -lcrypto... yes
    checking for openssl/ssl.h... yes
    checking for openssl/err.h... yes
    checking for rb_trap_immediate in ruby.h,rubysig.h... no
    checking for rb_thread_blocking_region()... no
    checking for inotify_init() in sys/inotify.h... yes
    checking for writev() in sys/uio.h... yes
    checking for rb_wait_for_single_fd()... yes
    checking for rb_enable_interrupt()... no
    checking for rb_time_new()... yes
    checking for sys/event.h... no
    checking for epoll_create() in sys/epoll.h... yes
    creating Makefile
    
    To see why this extension failed to compile, please check the mkmf.log which can be found here:
    
                                                     ^
    Makefile:230: recipe for target 'em.o' failed
    make: *** [em.o] Error 1
    
    make failed, exit code 2
    
    Gem files will remain installed in /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/eventmachine-1.0.3 for
    inspection.
    Results logged to
    /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/eventmachine-1.0.3/gem_make.out
    
    An error occurred while installing eventmachine (1.0.3), and Bundler cannot continue.
    Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.
    

    解决方案:

    1 回复  |  直到 7 年前
        1
  •  3
  •   mjr    7 年前

    试着跑步 bundle update json 强制更新 json gem clean ,删除您的 Gemfile.lock 然后再运行所有的程序。

    编辑:看起来您的捆绑程序版本与您的rails版本不兼容。您可以通过运行以下命令来尝试降级捆绑程序:

    1. gem install bundler --version '1.14.6'
    2. gem uninstall bundler --version '2.0.1'

    还有,这是一个新项目吗?如果是的话,你应该考虑使用Rails 5。随着Rails 6的发布,Rails 3即将成为三个主要版本。这也将有助于避免许多此类创业板问题。

    推荐文章