rails generate rspec:install - no such file to load --sprockets/railtie (LoadError)

后端 未结 3 1357
广开言路
广开言路 2021-02-09 12:40

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

相关标签:
3条回答
  • 2021-02-09 13:14

    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

    0 讨论(0)
  • 2021-02-09 13:18

    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! :)

    0 讨论(0)
  • 2021-02-09 13:37

    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)

    0 讨论(0)
提交回复
热议问题