0

我是红宝石新手。我正在尝试安装一个 ruby​​ gem 薄。它在安装 gem 时显示错误。我用谷歌搜索了这个错误,但我找不到解决我问题的链接。

错误是:

    C:\Users\name\Desktop>ruby -v
    ruby 2.0.0p247 (2013-06-27) [i386-mingw32]

    C:\Users\name\Desktop>gem -v
    2.0.3

    C:\Users\name\Desktop>gem install thin
    Temporarily enhancing PATH to include DevKit...
    Building native extensions.  This could take a while...
    ERROR:  Error installing thin:
            ERROR: Failed to build gem native extension.

        C:/Ruby200/bin/ruby.exe extconf.rb
    checking for main() in -lc... *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary
    libraries and/or headers.  Check the mkmf.log file for more details.  You may
    need configuration options.

    Provided configuration options:
            --with-opt-dir
            --without-opt-dir
            --with-opt-include
            --without-opt-include=${opt-dir}/include
            --with-opt-lib
            --without-opt-lib=${opt-dir}/lib
            --with-make-prog
            --without-make-prog
            --srcdir=.
            --curdir
            --ruby=C:/Ruby200/bin/ruby
            --with-thin_parser-dir
            --without-thin_parser-dir
            --with-thin_parser-include
            --without-thin_parser-include=${thin_parser-dir}/include
            --with-thin_parser-lib
            --without-thin_parser-lib=${thin_parser-dir}/
            --with-clib
            --without-clib
    C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
    You have to install development tools first.
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:515:in `try_link0'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:530:in `try_link'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:716:in `try_func'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:946:in `block in have_library'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:891:in `block in checking_for'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:336:in `block (2 levels) in postpone'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:306:in `open'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:336:in `block in postpone'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:306:in `open'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:332:in `postpone'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:890:in `checking_for'
            from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:941:in `have_library'
            from extconf.rb:4:in `<main>'


    Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/thin-1.6.0 for inspection.
    Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/thin-1.6.0/ext/thin_parser/gem_make.out

    C:\Users\name\Desktop>

任何帮助真的很感激。谢谢。

4

1 回答 1

1

我按照这些步骤解决了这个问题。发布此答案,因为它可能对其他人有用。

我卸载并删除了所有 ruby​​ 的东西并重新启动了机器。从此处http://rubyinstaller.org/downloads/下载 Ruby 2.0 和 Devkit 。

安装了 ruby​​ 和 devkit。使用此链接https://github.com/oneclick/rubyinstaller/wiki/Development-Kit中给出的说明安装 devkit 。

cd到ruby文件夹并安装rails,thin gem

于 2013-11-04T23:12:52.753 回答