dimanche 4 octobre 2015

Rails not working in development after precompiling assets

I have a Rails/EmberCLI app that uses the ember-cli-rails gem. To deploy it on Heroku, I ran rake assets:precompile. Back in development mode, I was still being served those assets, so I tried running rake assets:clean and rake assets:clobber. Now the app won't load, and I get the following errors:

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.

I've tried switching browsers, clearing the browser cahce, a bunch of different configurations of development.rb, and various other responses on Stack Overflow, but nothing seems to be working.

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> tag of 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 (followed instructions from the gem's README)

<%= 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'




Aucun commentaire:

Enregistrer un commentaire