Ruby windows安装程序:无法运行gem - 找不到所需的文件

时间:2012-03-23 01:58:12

标签: ruby rubygems gem

我是红宝石的新手。我试图在rails上获取ruby,但gem命令在我的系统上不起作用。搜索了互联网和SO网站,但找不到这个具体问题。我意识到这必须是基本的错误,但我不知道它是什么......以下是详细信息:

http://rubyforge.org/frs/?group_id=167获得ruby安装程序,安装顺利。从http://rubygems.org/pages/download下载的解压缩的ruby gems,解压缩并在解压缩的目录中运行:

ruby​​ setup.rb

输出:

C:/tools/rubygems-1.8.17# ruby setup.rb
RubyGems 1.8.17 installed

== 1.8.17 / 2012-02-17

* 2 minor enhancements:

 * Add MacRuby to the list of special cases for platforms (ferrous26)
 * Add a default for where to install rubygems itself

* 3 bug fixes:

 * Fixed gem loading issue caused by dependencies not resolving.
 * Fixed umask error when stdlib is required and unresolved dependencies exist.

 * Shebang munging would only take one arg after the cmd
 * Define SUCKAGE better, ie only MRI 1.9.2
 * Propagate env-shebang to the pristine command if set for install.


------------------------------------------------------------------------------

RubyGems installed the following executables:
        C:/tools/ruby/bin/e
        C:/tools/ruby/bin/gem

当我尝试运行gem时,我收到以下错误:

C:/tools/ruby# gem env
    require: C:/tools/ruby/bin/gem 8: not found
    require: C:/tools/ruby/bin/gem 9: not found
    require: C:/tools/ruby/bin/gem 10: not found
    required_version: C:/tools/ruby/bin/gem 12: not found
    unless: C:/tools/ruby/bin/gem 14: not found
    abort: C:/tools/ruby/bin/gem 15: not found
    end: C:/tools/ruby/bin/gem 16: not found
    args: C:/tools/ruby/bin/gem 18: not found
    begin: C:/tools/ruby/bin/gem 20: not found
    Gem::GemRunner.new.run: C:/tools/ruby/bin/gem 21: not found
    rescue: C:/tools/ruby/bin/gem 22: not found
    exit: C:/tools/ruby/bin/gem 23: unknown operator in arithmetic expression "e.exit_code" near e.

我重新安装了所有内容,在为宝石运行“ruby setup.rb”之前,我定义了GEM_HOME目录,指向C:/ tools / ruby​​ / gems(我创建的)。这没有任何帮助。任何指针都赞赏。

2 个答案:

答案 0 :(得分:0)

验证gem二进制文件是否在您的可执行文件路径中。

答案 1 :(得分:0)

我在Windows XP上。我想在我的设置中跟进/对\的解释,这指向我的罪魁祸首:我在我的系统上安装了MKS Toolkit并执行从bash而不是windows cmd执行的所有操作。一旦我切换到Windows cmd,宝石终于正常工作。一个简单的事情,但需要花费数小时来调试...