预编译资产后,Rails不在开发中工作

时间:2015-10-04 16:41:31

标签: ruby-on-rails ruby heroku ember.js asset-pipeline

我有一个使用ember-cli-rails gem的Rails / EmberCLI应用程序。要在Heroku上部署它,我运行了rake assets:precompile。回到开发模式,我仍然在为这些资产提供服务,所以我尝试了rake assets:cleanrake assets:clobber。现在,当我使用rails s在本地运行时,应用程序将无法加载,并且我收到以下错误:

GET http://localhost:3000/stylesheets/application.css 500 (Internal Server Error)
Refused to execute script from 'http://localhost:3000/javascripts/application.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
GET http://localhost:3000/stylesheets/frontend/vendor.css 
GET http://localhost:3000/stylesheets/frontend/frontend.css 
Refused to execute script from 'http://localhost:3000/javascripts/frontend/vendor.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Refused to execute script from 'http://localhost:3000/javascripts/frontend/frontend.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

我尝试过切换浏览器,清除浏览器cahce,development.rb的一堆不同配置,以及Stack Overflow上的各种其他响应,但似乎没有任何效果。

development.rb

Rails.application.configure do
  config.cache_classes = false
  config.eager_load = false
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false
  config.action_mailer.raise_delivery_errors = false
  config.active_support.deprecation = :log
  config.active_record.migration_error = :page_load
  config.assets.debug = true
  config.assets.compile = false
  config.assets.serve_static_assets = true
  config.assets.digest = true
  config.assets.raise_runtime_errors = true
  config.assets.enabled = false
end
<head>

application.html.erb标记:

 <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>

 <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
 <%= csrf_meta_tags %>

index.html.erb(遵循gem的自述文件中的说明)

<%= include_ember_script_tags :frontend %>
<%= include_ember_stylesheet_tags :frontend %>
<%= csrf_meta_tags %>

Gemfile:

ruby "2.2.1"
gem 'rails', '4.2.1'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'bcrypt', '~> 3.1.7'
gem "ember-cli-rails"
gem "figaro"
gem "httparty"
gem "rails_12factor", group: :production
gem 'pg'

group :development, :test do
  gem 'pry-byebug'

  gem 'web-console', '~> 2.0'
  gem 'spring'
end

gem 'puma'

0 个答案:

没有答案