本人成功在windows上安装RoR(ruby-1.9.3---rails-4.1.7)
步骤如下:
1. 在http://ruby-lang.org下载ruby-1.9.3安装版。安装
2. 在gem资源网站:
下载如下包:(进入上面其中一个网站,搜索,下载即可)
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: rails requires activesupport (= 4.1.7),
actionpack (= 4.1.7), actionview (= 4.1.7), activemodel (= 4.1.7),
activerecord (= 4.1.7), actionmailer (= 4.1.7), railties (= 4.1.7), bundler (< 2.0, >= 1.3.0),
sprockets-rails (~> 2.0)
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: sprockets-rails requires sprockets (< 4.0, >
= 2.8); railties requires thor (< 2.0, >= 0.18.1); actionmailer requires mail (>
= 2.5.4, ~> 2.5); activerecord requires arel (~> 5.0.0); activemodel requires bu
ilder (~> 3.1); actionpack requires rack (~> 1.5.2), rack-test (~> 0.6.2); actio
nview requires builder (~> 3.1), erubis (~> 2.7.0); activesupport requires i18n
(>= 0.6.9, ~> 0.6), json (>= 1.7.7, ~> 1.7), tzinfo (~> 1.1), minitest (~> 5.1),
thread_safe (~> 0.1)
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: sprockets requires hike (~> 1.2), multi_json
(~> 1.0), tilt (!= 1.3.0, ~> 1.1); mail requires mime-types (< 3, >= 1.16)
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: sprockets requires hike (~> 1.2), tilt (!= 1
.3.0, ~> 1.1)
当然还有rails-4.1.7
提供以上所有包的打包附件。大家直接可以下载使用。
3.把他们放在同一个文件夹。 进入命令窗口,cd到这个目录,
然后执行gem install rails
4. 你会得到下面的错误。
c:\Users\i076453\Downloads\rails>gem install rails
ERROR: Error installing rails:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from ' http://rubyinstaller.org/downloads' and follow the instructions
at ' http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
ERROR: Error installing rails:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from ' http://rubyinstaller.org/downloads' and follow the instructions
at ' http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
5. 在
http://rubyinstaller.org/downloads下载development kit
6. 按照
http://github.com/oneclick/rubyinstaller/wiki/Development-Kit所示安装devkit
就是进入devkit解压缩目录,运行
ruby dk.rb init 和 ruby dk.rb install 命令即可。
7. 运行命令
gem install json --platform=ruby测试是否devkit安装成功。
8.再次运行gem install rails在上面指定目录,安装成功!
如果提示文档安装错误,可以使用如下命令:
gem install --no-ri --no-rdoc rails