Refinery - Sprockets::FileNotFound - 找不到类型为 'application/javascript' 的文件 'bootstrap':

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

我有一个使用 bootstrap css 和 js 的工作应用程序。我正在尝试按照本指南向其中添加炼油厂: http://www.refinerycms.com/guides/with-an-existing-rails-app

我执行以下操作

  1. gem 'refinerycms', '~> 3.0.0'
  2. 捆绑安装
  3. rails 生成 refinery:cms --fresh-installation
  4. rails s
  5. 转到localhost:3000

我收到以下错误:

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'

更新:

我设置了一个简单的项目来演示这个问题 在这里找到它 https://github.com/thebravoman/refinery_error_example 并解释如何 运行 它。

我明白了。

在 Gemfile 中有一行

gem 'bootstrap-sass'

如果你加上

gem 'refinerycms' 

在这一行之前就会出现错误

如果你加上

gem 'refinerycms' 

在这一行之后就没有错误发生了。

我想这现在应该作为错误报告并进一步调查为什么这个顺序很重要,但这可能是另一个问题的一部分。