1

我正在尝试使用 ruby​​ 安装程序在 rails (v4.0) 上安装 ruby​​。它向我抛出了这个错误。我是 RoR 的新手,一些网站告诉我安装 devkit。我已经做到了。我跑gem install thin

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

    C:/RubyRails/bin/ruby.exe extconf.rb
*** 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:/RubyRails/bin/ruby
        --with-atomic_reference-dir
        --without-atomic_reference-dir
        --with-atomic_reference-include
        --without-atomic_reference-include=${atomic_reference-dir}/include
        --with-atomic_reference-lib
        --without-atomic_reference-lib=${atomic_reference-dir}/
C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to gene
rate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
        from C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
        from extconf.rb:22:in `<main>'


Gem files will remain installed in C:/RubyRails/lib/ruby/gems/2.0.0/gems/atomic-
1.1.10 for inspection.
Results logged to C:/RubyRails/lib/ruby/gems/2.0.0/gems/atomic-1.1.10/ext/gem_ma
ke.out

预先感谢您的帮助

4

4 回答 4

4

如果在 Windows 上,您需要安装 Ruby DevKit,从:http ://rubyinstaller.org/downloads/ 获取它(向下滚动一点)。

于 2013-07-02T18:47:28.693 回答
0

尝试使用来自http://railsinstaller.org/的 railsinstaller 它将安装以下

Ruby 1.9.3-p392
Rails 4
Bundler
Git
Sqlite
TinyTDS
SQL Server Support
DevKit
于 2013-07-13T10:14:50.773 回答
0

当您尝试结合使用 32 位 Ruby 和 64 位 DevKit 时,也会发生同样的情况。解决方案是使用同位版本。

例如当前版本:rubyinstaller-2.0.0-p247-x64.exe DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

于 2013-09-18T09:19:10.420 回答
0

同样的故事在这里删除 ruby​​ 并安装:

  • 红宝石 2.0.0-p247
  • DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

http://rubyinstaller.org/downloads/解决了这个问题。

于 2013-07-13T01:12:49.767 回答