2014-12-27 36 views
1

在我的筆記本電腦,我的紅寶石的版本是:爲什麼不能heroku安裝nokogiri 1.6.5,在竹堆上使用ruby 1.9.2?

$ ruby -version 
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-darwin14.0.0] 

和我的軌道版本是:

$ ./bin/rails -v 
Rails 3.2.15 

我的Gemfile有一個無版本參考引入nokogiri:

$ grep nokogiri Gemfile 
gem "nokogiri" 

但我的Gemfile.lock顯示:

nokogiri (1.6.5) 
    mini_portile (~> 0.6.0) 

我是傳統的竹堆棧:

$ heroku info | grep -i stack 
Stack:   bamboo-mri-1.9.2 

,當我推到Heroku的(使用Git ssh傳輸):

$ git push heroku master 

當它到達引入nokogiri依賴部署炸彈:

... 
    Installing nokogiri (1.6.5) with native extensions /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) 

    /usr/ruby1.9.2/bin/ruby extconf.rb 
    *** extconf.rb failed *** 
    Could not create Makefile due to some reason, probably lack of 
    necessary libraries and/or headers. Check the mkmf.log file for more 
    details. You may need configuration options. 

    Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/ruby1.9.2/bin/ruby 
    --help 
    --clean 
    /usr/ruby1.9.2/lib/ruby/1.9.1/mkmf.rb:445:in `try_compile': wrong number of arguments (3 for 2) (ArgumentError) 
    from extconf.rb:77:in `block in add_cflags' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/mkmf.rb:481:in `with_cflags' 
    from extconf.rb:76:in `add_cflags' 
    from extconf.rb:323:in `<main>' 
    checking if the C compiler accepts ... 

    Gem files will remain installed in /tmp/build_8908ccf0104d2f6073466c3fe2186d76/.bundle/gems/ruby/1.9.1/gems/nokogiri-1.6.5 for inspection. 
    Results logged to /tmp/build_8908ccf0104d2f6073466c3fe2186d76/.bundle/gems/ruby/1.9.1/gems/nokogiri-1.6.5/ext/nokogiri/gem_make.out 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `block in run' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `block in each' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/bin/bundle:13:in `<top (required)>' 
    from /usr/ruby1.9.2/bin/bundle:19:in `load' 
    from /usr/ruby1.9.2/bin/bundle:19:in `<main>' 
    FAILED: http://devcenter.heroku.com/articles/bundler 

!  Push failed: failed to install gems via Bundler 
!  If the problem persists, see http://help.heroku.com and provide Request ID 6f60ac09-059f-4a33-b913-02e32e2f34e4. 

任何想法如何解決這個問題?

回答

1

nokogiri 1.6.5是最新版本。 nokogiri的更新版本不支持nokogiri依賴和C庫安裝在竹棧中。不要忘記,竹堆將近4歲。

你假裝一個庫在不到一個月前發佈,可以針對4年前發佈的C庫進行編譯。 wrong number of arguments錯誤可能是由nokogiri所需的C庫之一的公共方法簽名的更改引起的。 nokogiri期望接受3個參數的方法,而C庫的舊版本只接受2.

您可以嘗試將nokogiri要求降級到較舊的版本。

gem 'nokogiri', '~> 1.4.0' 

事實上,最好的解決方案是升級到Cedar堆棧。無論如何,您最終都需要Bamboo堆棧將在幾個月內退役,並且在任何情況下您的應用都將停止工作。