在运行 git push heroku master 时在 heroku 上部署 rails 应用程序时遇到一些问题

它说 Sprockets::FileNotFound:找不到类型为“application/javascript”的文件“bootstrap-sprockets”

这是堆栈跟踪:

>remote:        rake aborted! 
remote:        Sprockets::FileNotFound: couldn't find file 'bootstrap-sprockets' with type 'application/javascript' 
remote:        Checked in these paths: 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/app/assets/config 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/app/assets/images 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/app/assets/javascripts 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/app/assets/stylesheets 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/coffee-rails-4.2.2/lib/assets/javascripts 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/actioncable-5.1.4/lib/assets/compiled 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/actionview-5.1.4/lib/assets/compiled 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/turbolinks-source-5.0.3/lib/assets/javascripts 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/node_modules 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/app/assets/javascripts/application.js:15 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/resolve.rb:65:in `resolve!' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:399:in `resolve' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:207:in `process_require_directive' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:180:in `block in process_directives' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:178:in `each' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:178:in `process_directives' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:83:in `_call' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:68:in `call' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:23:in `block in call' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/utils.rb:200:in `dfs' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:24:in `call' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define' 
remote:        /tmp/build_db1edd81ba80d924bf7071c38f395c26/vendor/bundle/ruby/2.3.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>' 

这是我的 app/assets/javascripts/application.js 文件

// This is a manifest file that'll be compiled into application.js, which will include all the files 
// listed below. 
// 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 
// vendor/assets/javascripts directory can be referenced here using a relative path. 
// 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// compiled file. JavaScript code in this file should be added after the last require_* statement. 
// 
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 
// about supported directives. 
// 
//= require rails-ujs 
//= require bootstrap-sprockets 
//= require turbolinks 
//= require_tre 

这是我的 app/assets/stylesheets/application.css.sass

/* 
 * This is a manifest file that'll be compiled into application.css, which will include all the files 
 * listed below. 
 * 
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 
 * vendor/assets/stylesheets directory can be referenced here using a relative path. 
 * 
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the 
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 
 * files in this directory. Styles in this file should be added after the last require_* statement. 
 * It is generally better to create a new file per style scope. 
 * 
 *= require_tree . 
 *= require_self 
 */ 
@import "bootstrap-sprockets" 
@import "bootstrap" 

这是我的 gemfile

source 'https://rubygems.org' 
 
git_source(:github) do |repo_name| 
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 
  "https://github.com/#{repo_name}.git" 
end 
 
gem 'twitter' 
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.1.4' 
 
# Use Puma as the app server 
gem 'puma', '~> 3.7' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 
 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.2' 
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 
gem 'turbolinks', '~> 5' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.5' 
# Use Redis adapter to run Action Cable in production 
# gem 'redis', '~> 3.0' 
# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 
 
# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 
 
group :development, :test do 
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 
  # Adds support for Capybara system testing and selenium driver 
  gem 'pg' 
  gem 'capybara', '~> 2.13' 
  gem 'selenium-webdriver' 
  gem 'dotenv-rails' 
  gem 'jquery-rails' 
  gem 'bootstrap-sass' 
  gem 'autoprefixer-rails' 
end 
 
group :development do 
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 
  gem 'web-console', '>= 3.3.0' 
  gem 'listen', '>= 3.0.5', '< 3.2' 
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 
  gem 'spring' 
  gem 'spring-watcher-listen', '~> 2.0.0' 
end 
 
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

我正在使用 ruby​​ 2.4.2p198,Rails 5.1.4

谁知道问题出在哪里?谢谢!

请您参考如下方法:

gem 'bootstrap-sass'  

也必须在生产组中。


评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!