在Ruby on Rails中,我尝试按照http://railsinstaller.org/windows
中指示的分步说明在我的Windows机器上安装它在第7步,它说我们应该输入这个命令:
$ rails g controller welcome index
所以我这样做:
PS C:\Sites\railsinstaller_demo> rails g controller welcome index
我收到了这个错误:
C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in
`report_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError)
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:in
`activate_dep'
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in `activate'
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:in `gem'
from C:/RailsInstaller/Ruby1.9.3/bin/rails:18:in `<main>'
我已经搜索了这个错误,并且读到解决方案是安装de DevKit,所以我做了,但问题仍然存在。
导致这些错误的原因是什么?
编辑:
这是我运行gem list时出现的内容:
PS C:\Sites\railsinstaller_demo> gem list
*** LOCAL GEMS ***
actionmailer (3.2.9)
actionpack (3.2.9)
activemodel (3.2.9)
activerecord (3.2.9)
activeresource (3.2.9)
activesupport (3.2.9)
arel (3.0.2)
builder (3.0.4)
erubis (2.7.0)
foreman (0.60.2)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
mail (2.4.4)
mime-types (1.19)
minitest (1.6.0)
multi_json (1.5.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rake (0.8.7)
rdoc (2.5.8)
rest-client (1.6.7)
sequel (3.20.0)
sinatra (1.0)
sprockets (2.2.2)
taps (0.3.24)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
正如@EricLeschinski所建议的,我尝试了运行“gem install rails”但是出现了这个错误:
PS C:\Sites\railsinstaller_demo> 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'
最终编辑:
最后,我并没有把我的初始安装搞砸了,但我发现这个Youtube视频http://www.youtube.com/watch?v=WUdDdiu8kBs,这是安装我需要的所有内容的最清晰的方式,并且没有任何问题一切都按照她的指示进行。
答案 0 :(得分:1)
无法找到RubyGem栏杆
此错误是由于您使用的rails版本与Gemfile中定义的版本之间的差异造成的。
尝试rails -v
检查导轨版本。