ruby-on-rails - 如何在 Windows 上安装 RedCloth?

标签 ruby-on-rails ruby windows rubygems redcloth

运行 gem install RedCloth 时(在 Windows XP 上)我得到:

Fetching: RedCloth-4.2.8.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed RedCloth-4.2.8
1 gem installed
Installing ri documentation for RedCloth-4.2.8...
Installing RDoc documentation for RedCloth-4.2.8...
ERROR:  While generating documentation for RedCloth-4.2.8
... MESSAGE:   error generating index.html: Error while evaluating D:/Programs/R
uby/lib/ruby/gems/1.9.1/gems/rdoc-3.9/lib/rdoc/generator/template/darkfish/index
.rhtml: undefined method `[]' for nil:NilClass (RDoc::Error)
... RDOC args: --op D:/Programs/Ruby/lib/ruby/gems/1.9.1/doc/RedCloth-4.2.8/rdoc
 --charset=UTF-8 --line-numbers --title RedCloth --main README.rdoc lib lib/case
_sensitive_require ext README.rdoc COPYING CHANGELOG --title RedCloth-4.2.8 Docu
mentation --quiet

为什么会出现此错误?

然后我将 require 'RedCloth' 添加到 config/environment.rb,并尝试运行 rails s,但不幸的是我得到了:

D:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.8/lib/redcloth.rb:12:in `
require': no such file to load -- 1.9/redcloth_scan (LoadError)
Couldn't load 1.9/redcloth_scan
The $LOAD_PATH was: ...

我做错了什么?

我使用 Rails 3.0.1、Ruby 1.9.2。

bundle show RedCloth

=> D:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.8

最佳答案

这是我解决第二个错误“无法加载 1.9/redcloth_scan”的解决方法,它看起来像是 Windows 上 RedCloth 的错误。在 gem install RedCloth --no-rdoc 之后,我运行

cd c:\Ruby192\lib\ruby\gems\1.9.1\gems\RedCloth-4.2.8\lib
mkdir 1.9
copy redcloth_scan.so 1.9

当然,您应该将该目录替换为您的路径“D:\Programs\Ruby\lib\ruby\gems\1.9.1\gems\RedCloth-4.2.8\lib”。

关于ruby-on-rails - 如何在 Windows 上安装 RedCloth?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7290868/

相关文章:

ruby-on-rails - Date.current 和 Date.today 之间有什么区别?

ruby-on-rails - Rails 错误 : certificate verify failed. ..我已经尝试了一切

ruby - 为什么这个正则表达式在 ruby​​ 中为真?

c++ - 将主机名转换为 IPAddr

javascript - Ruby on Rails3.2 中的 javascript 文件中的 Sprockets::EncodingError

ruby-on-rails - 使用 Rails 实现 facebook-OmniAuth

ruby - 我可以将 ruby​​ 对象指针传递给 ruby​​-ffi 回调吗?

ruby - 在 Ubuntu for Discourse 上安装 fast_xor Gem 时遇到问题

c# - 是否可以启动远程应用程序并在 Windows 中以交互方式显示它?

c++ - Windows Batch - 如何在将标准输出重定向到文件时添加时间戳