简体   繁体   中英

Trouble loading Rails Server (3.0.11, ruby 1.9.2), no such file to load — sprockets/railtie (LoadError)

Using the Hartl tutorial.

Command: rails s

Response:

/Users/davidpardy/rails_projects/sample_app/config/application.rb:8:in `require': no such file     to load -- sprockets/railtie (LoadError)
    from /Users/davidpardy/rails_projects/sample_app/config/application.rb:8:in `<top     (required)>'
    from /Users/davidpardy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.11/lib/rails    /commands.rb:28:in `require'
    from /Users/davidpardy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.11/lib/rails    /commands.rb:28:in `block in <top (required)>'
    from /Users/davidpardy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.11/lib/rails    /commands.rb:27:in `tap'
    from /Users/davidpardy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.11/lib/rails    /commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

application.rb file below

require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
#require "rails/test_unit/railtie"

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  #Bundler.require(:default, :assets, Rails.env)
end

module SampleApp
  class Application < Rails::Application
    config.encoding = "utf-8"
    config.filter_parameters += [:password]
    config.assets.enabled = true
    config.assets.version = '1.0'
  end
end

Tried commenting out sprockets, just created more problems (and nothing came of that, unfortunately).

WUG thoughts?

You've downgraded your app to rails 3.0 but there are still a number of places with your application references 3.1 only methods or files.

sprockets/railtie is one of those, there will also be settings in your environment.rb referring to the asset pipeline and probably some others too (the wrap params stuff springs to mind). You would need at the very least to remove all of those.

As someone new to rails I'd strongly suggest you start with the version of rails the tutorial you are following was written for and stick with it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM