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

发布于 2024-10-16 18:07:03 字数 4446 浏览 9 评论 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

提前致谢。

I'm trying to add Redcloth to my Gem file, and when I run 'bundle install', I get the following:

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

If I run "gem install RedCloth" and then run "bundle install", it works, however when I actually try to use RedCloth in a model 'Vendor.rb' I get:

Uninitialized constant Vendor::RedCloth

Here's my 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

And here's my model:

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

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮光之海 2024-10-23 18:07:03

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

我还安装了 RedCloth 4.2.6 版本,然后无论我做什么都无法在 Sinatra 应用程序中使用它。 (我遇到了很多类似的错误,未初始化常量RedCloth。)但是,RedCloth 站点(http://redcloth.org/)表示最新的稳定版本只有 4.2.2。

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

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

This might be related to the problem I had this morning with RedCloth.

I also installed version 4.2.6 of RedCloth, and then could not use it in a Sinatra app, no matter what I did. (I got a lot of similar errors, Uninitialized constant RedCloth.) However, the RedCloth site (http://redcloth.org/) says the latest stable version is only 4.2.2.

I uninstalled 4.2.6 and installed 4.2.2, and it worked perfectly.

Try adding the restriction to your Gemfile, i.e. gem 'RedCloth', '4.2.2'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文