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>'
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.
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.
Here's what I did:
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
in your terminal type
$ bundle update
$ bundle install
then try again the command
rails generate rspec:install
Good luck! :)
How did you install rspec? Did you do a "gem install" or did you put it in your Gemfile? If it's only in your Gemfile, try putting "bundle exec" in front of your command, like this:
bundle exec rails g rspec:install
I know I have to use bundle exec when I run the specs, so you may need it for the init script too (I can't remember from when I did it, but I have the exact same ruby/rails versions)
Seems like you've created your project with a later version (rails 3.1) of rails gem. Make sure you're using a gemset which only has rails 3.0.9 gems and then do rails new to create your project. This will make sure that the sprockets/railtie line would not occur in your application.rb
来源:https://stackoverflow.com/questions/7192643/rails-generate-rspecinstall-no-such-file-to-load-sprockets-railtie-loaderr