首页 文章

在Ubuntu 10.10上的Rails 3.0.3和RVM上安装RedCloth时出错

提问于
浏览
0

我正在尝试将Redcloth添加到我的Gem文件中,当我运行'bundle install'时,我得到以下内容:

Installing RedCloth (4.2.6) with native extensions /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /home/user/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb 

Gem files will remain installed in /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/RedCloth-4.2.6 for inspection.
Results logged to /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/RedCloth-4.2.6/ext/redcloth_scan/gem_make.out
    from /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:507:in `block in build_extensions'
    from /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `each'
    from /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `build_extensions'
    from /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:156:in `install'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `block in run'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `block in each'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/bin/bundle:13:in `'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/bin/bundle:19:in `load'
    from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/bin/bundle:19:in `'

如果我运行“gem install RedCloth”然后运行“bundle install”,它可以工作,但是当我真正尝试在模型'Vendor.rb'中使用RedCloth时,我得到:

Uninitialized constant Vendor::RedCloth

这是我的gemfile:

gem 'rails', '3.0.3'


gem "compass", ">= 0.10.6"

gem "haml"
gem 'formtastic'

gem 'devise', :git => 'git://github.com/plataformatec/devise.git',  :branch => 'master'
gem 'oa-oauth', :require => "omniauth/oauth"
gem 'mogli'
gem 'dalli'
gem 'exceptional'
gem 'json'
gem 'RedCloth'

group :test, :development do
  gem "ruby-debug19"
  gem "rspec-rails", "~> 2.4"
  gem 'sqlite3-ruby', :require => 'sqlite3'
  gem 'hpricot'
  gem 'ruby_parser'
  gem 'heroku'
  gem "flutie"
end

group :test do
  gem 'cucumber-rails'
  gem 'capybara'
  gem 'database_cleaner'
  gem 'mocha'
  gem 'factory_girl_rails'
  gem 'shoulda'
  gem 'ZenTest'
  gem 'fakeweb'
end

这是我的模特:

class Vendor  ActiveRecord::Base
  has_many :reviews
  belongs_to :user

  validates_presence_of :name
  validates_presence_of :description

  before_save :convert_text

  def convert_text
    self.description = RedCloth.new(self.description).to_html unless self.description.nil?
    self.services_description = RedCloth.new(self.services_description).to_html unless self.services_description.nil?
    self.clients_description = RedCloth.new(self.clients_description).to_html unless self.clients_description.nil?
    self.pricing_description = RedCloth.new(self.pricing_description).to_html unless self.pricing_description.nil?
    self.press = RedCloth.new(self.press).to_html unless self.press.nil?
  end
end

提前致谢 .

1 回答

  • 0

    这可能与我今天早上使用RedCloth时遇到的问题有关 .

    我还安装了RedCloth的4.2.6版本,然后无论我做了什么,都无法在Sinatra应用程序中使用它 . (我有很多类似的错误, Uninitialized constant RedCloth . )但是,RedCloth网站(http://redcloth.org/)说最新的稳定版本只有4.2.2 .

    我卸载了4.2.6并安装了4.2.2,它运行得很好 .

    尝试将限制添加到您的Gemfile,即 gem 'RedCloth', '4.2.2'

相关问题