Ruby - kernel_require.rb:54 in'要求':无法加载此类文件(来自GitHub存储库)

时间:2014-11-17 23:41:59

标签: ruby github open-source git-clone pacman

我克隆了一个GitHub目录,因为我想帮助一个开源项目。

下面列出了该项目的链接,所以请随意为自己试一试。

https://github.com/tupini07/RubyMan

根据自述文件,我做了以下

git clone https://github.com/tupini07/RubyMan
cd projects/RubyMan
ruby main.rb

修改

我通过运行gem install win32console解决了第一个问题,但我仍然遇到了同样的问题。

错误消息

C:\Users\darkmouse\Documents\Projects\RubyMan>ruby main.rb
C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in 
`require': cannot load such file -- 2.0/Console_ext (LoadError)
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console.rb:12:in `rescue in <top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console.rb:8:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console/ANSI.rb:13:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/win32console.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from C:/Users/darkmouse/Documents/Projects/RubyMan/Board.rb:2:in `<top (required)>'
from main.rb:4:in `require_relative'
from main.rb:4:in `<main>'

main.rb的

3 require_relative 'player'
4 require_relative 'Board'
5 require_relative 'LoadLevel'

Board.rb

2 require 'win32console'

上面列出了这些问题。

我运行Windows 8操作系统。

我不想用问题轰炸存储库,所以我决定在这里问一下。

1 个答案:

答案 0 :(得分:3)

我将同样的GitHub项目RubyMan分叉,并在Ubuntu 14.04 LTS上克隆它。我安装了Ruby 2.2.2的当前稳定版本。当我改为RubyMan文件夹并运行时,我遇到了与上面几乎相同的问题:

ruby Main.rb

这是堆栈跟踪:

/usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- colorize (LoadError)
    from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/ashok/RubyMan/Board.rb:1:in `<top (required)>'
    from Main.rb:3:in `require_relative'
    from Main.rb:3:in `block in <main>'
    from Main.rb:3:in `each'
    from Main.rb:3:in `<main>'

遇到类似问题的其他人在GitHub上建议:

sudo gem install colorize

结果:

Successfully installed colorize-0.7.7

不幸的是,上述问题并没有消失:(我尝试了很多其他建议。没有运气。

然而,这两个步骤解决了这个问题: 第1步:

sudo gem update --system

结果:

RubyGems system software updated

据我所知,这会将所有已安装的宝石更新为最新版本。

第2步:

sudo gem install colorize

结果:

Successfully installed colorize-0.7.7

现在我可以通过运行:

来启动RubyMan程序
ruby Main.rb

结果:

What size will the board be?

当我输入一个数字时,它会显示准备播放的2D RubyMan游戏!