1

私はピーター・クーパーによる「初心者からプロへのRuby入門」からRubyを学んでいます。私は第 7 章にいます。Ruby 2.0 がインストールされています。私はこのエラーに直面しています:

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)

このコードを実行しようとすると:

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

私はこの結果を得ています:

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

ruby gem と RedCloth は既にインストール済みです。彼らは私にエラーを与えませんでした。誰かがこのトピックに光を当てることができれば、それは大歓迎です.

4

3 に答える 3

1

これを試してください: C:/Ruby200/lib/ruby/gems/2.0.0/gems/RedCloth-4.2.9-x86-mingw32/lib に移動し、「2.0」という名前のディレクトリを作成します。次に、redcloth_scan.so を「C:/Ruby200/lib/ruby/gems/2.0.0/gems/RedCloth-4.2.9-x86-mingw32/lib」から「2.0」ディレクトリにコピーします。

于 2014-08-21T09:23:10.563 に答える
0

Ruby 1.9.1 で過去の RedCloth にインストールしました。実際、RedCloth は Ruby 2.0 では動作しないのではないかと思います。

于 2014-08-21T15:24:27.710 に答える
0

ruby 2.xx では、gem をコンパイルする必要があります。たとえば、Windows Ruby 2.2.4 の場合:

DevKit をセットアップします ( https://github.com/oneclick/rubyinstaller/wiki/Development-Kit )

コマンド ウィンドウで実行します。

gem install RedCloth --platform=ruby

インストールされた RedCloth パス lib\ruby\gems\2.2.0\gems\RedCloth-4.2.9\lib に移動し、そこに「2.2」という名前の新しいディレクトリを作成し、そこにファイル redcloth_scan.so をコピーします。

gem RedCloth-4.2.9-x86-mingw32 を使用する場合、redcloth_scan.so には ruby​​ 1.9 の依存関係が含まれており、ruby 2.2.4 では機能しません。

于 2016-05-02T12:49:32.250 に答える