6

我克隆了一个 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>'

主文件

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

董事会.rb

2 require 'win32console'

上面列出了这些问题。

我运行 Windows 8 操作系统。

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

4

1 回答 1

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

我了解这会将所有已安装的 gem 更新到最新版本。

第2步:

sudo gem install colorize

结果:

Successfully installed colorize-0.7.7

现在我可以通过运行来启动 RubyMan 程序:

ruby Main.rb

结果:

What size will the board be?

当我输入一个数字时,它会显示 2D RubyMan 游戏可以玩了!

于 2015-05-12T19:48:21.420 回答