2013-02-05 31 views
11

Tôi đang cố gắng đẩy một ứng dụng thử nghiệm nhỏ lên Heroku. Dưới đây là những ứng dụng và các tập tin Gem:Tôi có thể sử dụng rdiscount trên Heroku như thế nào?

App:

require 'sinatra' 
require 'haml' 
require 'rdiscount' 

set :markdown, :layout_engine => :haml, :layout => :layout 


get '/' do 
    haml :index 
end 

get '/blog' do 
    markdown :test 
end 

Gemfile:

source :rubygems 
gem 'sinatra' 
gem 'thin' 
gem 'haml' 
gem 'rdiscount' 

Trước khi đẩy để Heroku tôi chạy bundle install. Nhưng đẩy để Heroku thất bại khi cố gắng cài đặt các viên ngọc rdiscount:

-----> Ruby/Rack app detected 
-----> Installing dependencies using Bundler version 1.3.0.pre.5 
    Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment 
    Fetching gem metadata from http://rubygems.org/.......... 
    Fetching gem metadata from http://rubygems.org/.. 
    Using daemons (1.1.9) 
    Using eventmachine (1.0.0) 
    Using haml (3.1.7) 
    Using rack (1.4.3) 
    Using rack-protection (1.3.2) 
    installing rdiscount (2.0.7) 
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 
    /usr/local/bin/ruby extconf.rb 
    checking for random()... yes 
    checking for srandom()... yes 
    checking for rand()... yes 
    checking for srand()... yes 
    checking size of unsigned long... long 
    checking size of unsigned int... int 
    no int with size 4 
    *** 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/local/bin/ruby 
    --with-rdiscount-dir 
    --without-rdiscount-dir 
    --with-rdiscount-include 
    --without-rdiscount-include=${rdiscount-dir}/include 
    --with-rdiscount-lib 
    --without-rdiscount-lib=${rdiscount-dir}/lib 
    Gem files will remain installed in /tmp/build_3aijv3ga0dy1y/vendor/bundle/ruby/1.9.1/gems/rdiscount-2.0.7 for inspection. 
    Results logged to /tmp/build_3aijv3ga0dy1y/vendor/bundle/ruby/1.9.1/gems/rdiscount-2.0.7/ext/gem_make.out 
    An error occurred while installing rdiscount (2.0.7), and Bundler cannot continue. 
    Make sure that `gem install rdiscount -v '2.0.7'` succeeds before bundling. 
! 
!  Failed to install gems via Bundler. 
! 
!  Heroku push rejected, failed to compile Ruby/rack app 

Tôi hiểu rdiscount mà có thể phụ thuộc vào một số Gems hoặc các thư viện khác và phụ thuộc này dường như không được giải quyết. Tuy nhiên, tôi không hiểu cách giải quyết vấn đề này. Bạn có thể cho tôi một số lời khuyên về cách để có được điều này để làm việc?

Trả lời

27

Dường như có sự cố với Ruby 1.9.2 trên Heroku và byte có thể là int.

Cố gắng thêm ruby "1.9.3" cho bạn Gemfile như thế này:

source :rubygems 
ruby "1.9.3" 

gem 'sinatra' 
gem 'thin' 
gem 'haml' 
gem 'rdiscount' 

thử nghiệm riêng của tôi sao chép lỗi của bạn trên 1.9.2 và đã thành công trên 1.9.3

+0

Ngoài ra lỗi này: https: // github. com/rtomayko/rdiscount/issues/48 – GregB

+0

Câu trả lời hay! Đã giải quyết vấn đề! Cảm ơn bạn rất nhiều!!! –

+0

Cảm ơn điều này, nó đã khắc phục sự cố cho tôi. – Jason

Các vấn đề liên quan