我如何在Heroku上使用rdiscount?(How can I use rdiscount on Heroku?)

系统教程 行业动态 更新时间:2024-06-14 17:02:17
我如何在Heroku上使用rdiscount?(How can I use rdiscount on Heroku?)

我正在尝试将一个小测试应用推送到Heroku。 这是App和Gem文件:

应用程序:

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'

在推送到Heroku之前,我运行bundle install 。 但试图安装rdiscount gem时推向Heroku失败:

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

我明白rdiscount可能取决于其他一些Gem或库,并且这种依赖似乎没有解决。 但是,我不明白如何解决这个问题。 你能给我一些关于如何使这个工作的建议吗?

I am trying to push a small test app to Heroku. Here is the App and the Gem file:

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'

Before pushing to Heroku I run bundle install. But pushing to Heroku fails when trying to install the rdiscount gem:

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

I do understand that rdiscount might depend on some other Gems or libraries and this dependency does not seem to be resolved. However, I do not understand how to solve this problem. Could you give me some advice on how to get this to work?

最满意答案

Heroku上的Ruby 1.9.2似乎有个问题,它认为int是多少个字节。

尝试添加ruby "1.9.3"给你像这样的Gemfile:

source :rubygems ruby "1.9.3" gem 'sinatra' gem 'thin' gem 'haml' gem 'rdiscount'

我自己的测试在1.9.2上再现了你的错误,并在1.9.3上成功

There seems to be an issue with Ruby 1.9.2 on Heroku and how may bytes it thinks int is.

Try to add ruby "1.9.3" to you Gemfile like this:

source :rubygems ruby "1.9.3" gem 'sinatra' gem 'thin' gem 'haml' gem 'rdiscount'

My own testing reproduced your error on 1.9.2 and succeeded on 1.9.3

更多推荐

本文发布于:2023-04-21 18:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/e43f82d68da3a5150b10cda627d55588.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Heroku   rdiscount

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!