rails 生成 rspec:install - 没有要加载的文件 --sprockets/railtie (LoadError) [英] rails generate rspec:install - no such file to load --sprockets/railtie (LoadError)
问题描述
我是一名 RoR 初学者,我开始通过 RoR 教程学习它.实际上我在这一章 (http://ruby.railstutorial.org/chapters/static-pages#top) 并尝试安装 rspec.但是每次当我尝试使用rails g rspec:install"时,我都会收到此错误消息:
I'm a RoR-Beginner and I started learning it with the RoR-Tutorial. Actually I'm at this chapter (http://ruby.railstutorial.org/chapters/static-pages#top) and try to install rspec. But everytime when I try to use "rails g rspec:install" I get this error message:
C:\Sites\rails\rails_projects\sample_appp>rails g rspec:install
C:/Sites/rails/rails_projects/sample_appp/config/application.rb:8:in `require':
no such file to load -- sprockets/railtie (LoadError)
from C:/Sites/rails/rails_projects/sample_appp/config/application.rb:8:i
n `<top (required)>'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.0.9
/lib/rails/commands.rb:15:in `require'
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.0.9
/lib/rails/commands.rb:15:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
有人想帮我吗?我已经尝试在 application.rb 中将其注释掉或在 gemfile 中明确提及它.但我仍然收到此错误消息.
Has anybody an idea to help me? I already tried to comment it out in the application.rb or to explicitly mention it in the gemfile. But I still get this error message.
如果有人能帮助我就好了.顺便提一句.我的操作系统是 Windows XP,我使用的是 Ruby 版本 1.9.2.p290 和 Rails 版本 3.1.0.rc6.
Would be great if anyone could help me. Btw. my OS is Windows XP and I'm using Ruby version 1.9.2.p290 and Rails version 3.1.0.rc6.
推荐答案
这是我所做的:
网站上的 gemfile 显然有点错误,我正在使用这个:
the gemfile on the site is apparently slightly wrong, i'm using this:
source 'http://rubygems.org'
gem "rails", "~> 3.1.0"
gem 'sqlite3', '1.3.3'
group :development do
gem 'rspec-rails', '2.6.1'
end
group :test do
gem 'rspec-rails', '2.6.1'
gem 'webrat', '0.7.1'
end
在您的终端类型中
$ bundle update
$ bundle install
然后再试一次命令
rails generate rspec:install
祝你好运!:)
这篇关于rails 生成 rspec:install - 没有要加载的文件 --sprockets/railtie (LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!