gpt4 book ai didi

ruby - 我如何在 Heroku 上使用 rdiscount?

转载 作者:数据小太阳 更新时间:2023-10-29 06:42:53 26 4
gpt4 key购买 nike

我正在尝试将一个小型测试应用程序推送到 Heroku。这是应用程序和 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

gem 文件:

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 可能依赖于其他一些 Gems 或库,而且这种依赖性似乎没有得到解决。但是,我不明白如何解决这个问题。你能给我一些关于如何让它工作的建议吗?

最佳答案

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 上成功

关于ruby - 我如何在 Heroku 上使用 rdiscount?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14701516/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com