我克隆了一个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>'
主RB
3 require_relative 'player'
4 require_relative 'Board'
5 require_relative 'LoadLevel'
寄宿家庭
2 require 'win32console'
上面列出了这些问题。
我运行一个windows 8操作系统。
我不想用问题轰炸存储库,所以我决定在这里问。
最佳答案
我创建了同一个Github项目Rubyman,并在Ubuntu14.04LTS上克隆了它。我安装了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游戏准备好了!