Rails 安装了好久,一直没成功 gem install rails 下载下来 gem 也不行~ 真的无助了~。。都不知道那种方法能安装了~ 各位有没有好的教程!
感谢四位,我是 winxp 下,cmd 命令安装,请帮忙看下! #4 楼 @Martin91 #3 楼 @floger #1 楼 @leozwa #2 楼 @longfellow
cmd 命令下的错误信息: C:\Documents and Settings\Administrator>gem install rails Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb checking for libkern/OSAtomic.h... *** 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:/Ruby192/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}/lib
C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in try_do': The complier failed to genera
te an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:452:in
try_cpp'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:834:in block in have_header'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in
block in checking_for'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in block (2 levels) in postp
one'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in block in postpone'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in postpone'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in
checking_for'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:833:in have_header'
from extconf.rb:17:in
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/atomic-1. 1.15 for inspection. Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/at omic-1.1.15/gem_make.out
You have to install development tools first.
为何不试试 http://railsinstaller.org/en
#添加/删除Gem源
$ gem source -a http://ruby.taobao.org
$ gem source -r https://rubygems.org/
#安装Rails
$ gem install rails
$ ruby -v #查看已经安装的Ruby版本
$ rails -v #查看已经安装的Rails版本
#23 楼 @gzh8579 没 vagrant+virtualbox 方便。这个搭好了,要是换机器了,很方便打包到其它环境继续用。
SSH 端口默认本地 2222
楼主用 Windows,后续还会遇到很多开发方面的问题,整个 Ruby 的生态环境都是在 UNIX/Linux 上的,如果有钱,买台 Mac 绝对值,如果想成本第一点,找任何 PC 机装个 Linux 就行。
Linux 没有你想得那么难,至少比 Ruby 还简单,你学得会 Ruby,自然学得会 Linux。
安装环境 win 7 64bit 使用 railsinstaller 一键安装之后, gem-v 和 ruby -v 正常。 gem list 能看到 rails,看不到 devkit,然后 rails -v 和 devkit -v 都提示没有这命令。 在 railsinstaller 文件下有 devklit 文件夹。
有人遇到类似的问题吗?
编辑 RailsInstaller\Ruby2.3.0\bin\rails.bat 替换为: @ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*