twitter-bootstrapruby-on-rails-3asset-pipelinesprocketsrefinerycms

Refinery - Sprockets::FileNotFound - couldn't find file 'bootstrap' with type 'application/javascript':


I have a working application with bootstrap css and js. I am trying to add refinery to it following this guide: http://www.refinerycms.com/guides/with-an-existing-rails-app

I do the following

  1. gem 'refinerycms', '~> 3.0.0'
  2. bundle install
  3. rails generate refinery:cms --fresh-installation
  4. rails s
  5. go to localhost:3000

And I get the following error:

Sprockets::FileNotFound - couldn't find file 'bootstrap' with type 'application/javascript':
  sprockets (3.5.2) lib/sprockets/directive_processor.rb:182:in `rescue in block in process_directives'
  sprockets (3.5.2) lib/sprockets/directive_processor.rb:179:in `block in process_directives'
  sprockets (3.5.2) lib/sprockets/directive_processor.rb:178:in `process_directives'
  sprockets (3.5.2) lib/sprockets/directive_processor.rb:83:in `_call'
  sprockets (3.5.2) lib/sprockets/directive_processor.rb:68:in `call'
  sprockets (3.5.2) lib/sprockets/processor_utils.rb:75:in `call_processor'
  sprockets (3.5.2) lib/sprockets/processor_utils.rb:57:in `block in call_processors'

  sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `call_processors'
  sprockets (3.5.2) lib/sprockets/loader.rb:134:in `load_from_unloaded'
  sprockets (3.5.2) lib/sprockets/loader.rb:60:in `block in load'
  sprockets (3.5.2) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
  sprockets (3.5.2) lib/sprockets/loader.rb:44:in `load'
  sprockets (3.5.2) lib/sprockets/cached_environment.rb:20:in `block in initialize'
  sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `load'
  sprockets (3.5.2) lib/sprockets/bundle.rb:23:in `block in call'
  sprockets (3.5.2) lib/sprockets/utils.rb:183:in `dfs'
  sprockets (3.5.2) lib/sprockets/bundle.rb:24:in `call'
  sprockets (3.5.2) lib/sprockets/processor_utils.rb:75:in `call_processor'
  sprockets (3.5.2) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
  sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `call_processors'
  sprockets (3.5.2) lib/sprockets/loader.rb:134:in `load_from_unloaded'
  sprockets (3.5.2) lib/sprockets/loader.rb:60:in `block in load'
  sprockets (3.5.2) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
  sprockets (3.5.2) lib/sprockets/loader.rb:44:in `load'
  sprockets (3.5.2) lib/sprockets/cached_environment.rb:20:in `block in initialize'
  sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `load'
  sprockets (3.5.2) lib/sprockets/base.rb:66:in `find_asset'
  sprockets (3.5.2) lib/sprockets/environment.rb:30:in `find_asset'
  sprockets (3.5.2) lib/sprockets/base.rb:92:in `[]'
  sprockets-rails (2.3.3) lib/sprockets/rails/helper.rb:230:in `lookup_asset_for_path'
  sprockets-rails (2.3.3) lib/sprockets/rails/helper.rb:138:in `block in javascript_include_tag'
  sprockets-rails (2.3.3) lib/sprockets/rails/helper.rb:136:in `javascript_include_tag'
  app/views/layouts/application.html.erb:201:in `_app_views_layouts_application_html_erb__2086046959781884270_70248866320820'
  actionview (4.2.4) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
  actionview (4.2.4) lib/action_view/template.rb:333:in `instrument'
  actionview (4.2.4) lib/action_view/template.rb:143:in `render'
  actionview (4.2.4) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
  actionview (4.2.4) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
  actionview (4.2.4) lib/action_view/renderer/template_renderer.rb:14:in `render'
  actionview (4.2.4) lib/action_view/renderer/renderer.rb:42:in `render_template'
  actionview (4.2.4) lib/action_view/renderer/renderer.rb:23:in `render'
  actionview (4.2.4) lib/action_view/rendering.rb:100:in `_render_template'
  actionpack (4.2.4) lib/action_controller/metal/streaming.rb:217:in `_render_template'
  actionview (4.2.4) lib/action_view/rendering.rb:83:in `render_to_body'
  actionpack (4.2.4) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
  actionpack (4.2.4) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
  actionpack (4.2.4) lib/abstract_controller/rendering.rb:25:in `render'
  actionpack (4.2.4) lib/action_controller/metal/rendering.rb:16:in `render'
  actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
  activesupport (4.2.4) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
  /home/kireto/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
  activesupport (4.2.4) lib/active_support/core_ext/benchmark.rb:12:in `ms'
  actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
  actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
  activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
  actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:43:in `render'
  refinerycms-pages (3.0.2) lib/refinery/pages/instance_methods.rb:21:in `render'
  app/controllers/static_controller.rb:17:in `index'

Update:

I have setup a simple project to demonstrate the problem Find it here https://github.com/thebravoman/refinery_error_example with explanation on how to run it.


Solution

  • I got it.

    In the Gemfile there is a line

    gem 'bootstrap-sass'
    

    If you add

    gem 'refinerycms' 
    

    before this line then the error occurs

    If you add

    gem 'refinerycms' 
    

    after this line then no error occurs.

    I suppose this should now be reported as a bug and investigated further on why this order is important, but that is probably part of another question.