1

I'm learning Ruby from "Beginning Ruby from Novice to Professional" by Peter Cooper. I am on Chapter 7. I have ruby 2.0 installed. I am facing this error:

C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- 2.0/redcloth_scan (LoadError)

When trying to run this code:

require 'rubygems'
require 'RedCloth'
r = RedCloth.new("This is a *test* of _using RedCloth_")
puts r.to_html

I'm getting this result:

ruby redcloth.rb
C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- 2.0/redcloth_scan (LoadError)
Couldn't load 2.0/redcloth_scan
The $LOAD_PATH was:
C:/Ruby200/lib/ruby/gems/2.0.0/gems/RedCloth-4.2.9-x86-mingw32/lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/RedCloth-4.2.9-x86-mingw32/lib/case_sensitive_require
C:/Ruby200/lib/ruby/gems/2.0.0/gems/RedCloth-4.2.9-x86-mingw32/ext
C:/Ruby200/lib/ruby/site_ruby/2.0.0
C:/Ruby200/lib/ruby/site_ruby/2.0.0/i386-msvcrt
C:/Ruby200/lib/ruby/site_ruby
C:/Ruby200/lib/ruby/vendor_ruby/2.0.0
C:/Ruby200/lib/ruby/vendor_ruby/2.0.0/i386-msvcrt
C:/Ruby200/lib/ruby/vendor_ruby
C:/Ruby200/lib/ruby/2.0.0
C:/Ruby200/lib/ruby/2.0.0/i386-mingw32
    from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/RedCloth-4.2.9-x86-mingw32/lib/RedCloth.rb:13:in `<top (required)>'
    from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from redcloth.rb:2:in `<main>'
Exit code: 1

I already installed ruby gems and RedCloth. They didn't give me an errors. If somebody could shed some light on this topic it would be greatly appreciated.

Holger Just
  • 52,918
  • 14
  • 115
  • 123
  • See this post: http://stackoverflow.com/questions/3939411/how-to-use-rails3-with-redcloth-require-redcloth-not-working?rq=1 – WeezHard Aug 21 '14 at 10:45

3 Answers3

1

try this: goto into C:/Ruby200/lib/ruby/gems/2.0.0/gems/RedCloth-4.2.9-x86-mingw32/lib and create a dir named '2.0'. Then copy redcloth_scan.so from 'C:/Ruby200/lib/ruby/gems/2.0.0/gems/RedCloth-4.2.9-x86-mingw32/lib' into '2.0' dir.

0

I installed in past RedCloth with Ruby 1.9.1. Actually I suspect that RedCloth doesn't work with Ruby 2.0.

0

On ruby 2.x.x you need to compile the gem. For example for the windows ruby 2.2.4:

Setup the DevKit (https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)

Run into command window:

gem install RedCloth --platform=ruby

Goto to your installed RedCloth path lib\ruby\gems\2.2.0\gems\RedCloth-4.2.9\lib Create there a new directory called "2.2" and copy the file redcloth_scan.so on it.

If you use the gem RedCloth-4.2.9-x86-mingw32, the redcloth_scan.so contains the ruby 1.9 dependency and it doesn't works with ruby 2.2.4.

Luz De Gan
  • 66
  • 2
  • 5