Sprockets :: FileNotFound:找不到类型为'application / javascript'

时间:2017-08-04 18:45:03

标签: javascript ruby-on-rails

我有依赖字段在开发中工作但在Heroku上没有生产。当我尝试运行heroku rake资产时:precompile --trace我得到以下输出,包括错误。我究竟做错了什么?非常感谢所有帮助!我是Rails的新手。感谢。

** Execute assets:precompile
rake aborted!
Sprockets::FileNotFound: couldn't find file 'jquery.turbolinks' with type 'application/javascript'
Checked in these paths:
  /app/app/assets/config
  /app/app/assets/images
  /app/app/assets/javascripts
  /app/app/assets/stylesheets
  /app/vendor/assets/javascripts
  /app/vendor/assets/stylesheets
  /app/vendor/bundle/ruby/2.3.0/gems/jquery-rails-4.1.1/vendor/assets/javascripts
  /app/vendor/bundle/ruby/2.3.0/gems/coffee-rails-4.2.1/lib/assets/javascripts
  /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.1/lib/assets/compiled
  /app/vendor/bundle/ruby/2.3.0/gems/turbolinks-source-5.0.3/lib/assets/javascripts
  /app/vendor/bundle/ruby/2.3.0/gems/bootstrap-sass-3.3.7/assets/stylesheets
  /app/vendor/bundle/ruby/2.3.0/gems/bootstrap-sass-3.3.7/assets/javascripts
  /app/vendor/bundle/ruby/2.3.0/gems/bootstrap-sass-3.3.7/assets/fonts
  /app/vendor/bundle/ruby/2.3.0/gems/bootstrap-sass-3.3.7/assets/images

我的Gemfile:

source 'https://rubygems.org'

gem 'rails',        '5.0.1'
gem 'bcrypt',         '3.1.11'
gem 'faker',          '1.7.3'
gem 'will_paginate',           '3.1.5'
gem 'bootstrap-will_paginate', '1.0.0'
gem 'bootstrap-sass', '3.3.7'
gem 'puma',         '3.4.0'
gem 'sass-rails',   '5.0.6'
gem 'uglifier',     '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks',   '5.0.1'
gem 'jbuilder',     '2.4.1'


group :development, :test do
  gem 'sqlite3', '1.3.12'
  gem 'byebug',  '9.0.0', platform: :mri
end

group :development do
  gem 'web-console',           '3.1.1'
  gem 'listen',                '3.0.8'
  gem 'spring',                '1.7.2'
  gem 'spring-watcher-listen', '2.0.0'
  gem 'jquery-turbolinks'
  gem 'dependent-fields-rails'
end

group :test do
  gem 'rails-controller-testing', '0.1.1'
  gem 'minitest-reporters',       '1.1.9'
  gem 'guard',                    '2.13.0'
  gem 'guard-minitest',           '2.4.4'
  gem 'minitest', '~> 5.10', '!= 5.10.2'
end

group :production do
  gem 'pg', '0.18.4'

end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

这是我的application.js

请注意,我添加了以“document.addEventListener(”turbolinks:load“,function(){”开头的包装器,以解决依赖字段功能仅在刷新页面后在开发中工作的问题。

//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require bootstrap-sprockets
//= require turbolinks
//= require underscore
//= require dependent-fields
//= require_tree .

document.addEventListener("turbolinks:load", function() {

 $(document).ready(function() {
     DependentFields.bind()
 });

})

0 个答案:

没有答案