I'm getting the error in the title when I deploy my Rails 5 app. I recently updated my Gemfile to include some more recent versions. I don't have any issues on my local development environment but when I push to Heroku, which is in "production mode" there's an error that appears to be connected to asset precompilation.
Here's what I see in the logs:
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: yarn install v1.22.10
remote: [1/5] Validating package.json...
remote: [2/5] Resolving packages...
remote: success Nothing to install.
remote: success Saved lockfile.
remote: Done in 0.07s.
remote: rake aborted!
remote: LoadError: cannot load such file -- sass
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/autoload/sass.rb:1:in `<top (required)>'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:47:in `initialize'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:26:in `new'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:26:in `instance'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:34:in `cache_key'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:93:in `processor_cache_key'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:22:in `block in initialize'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:53:in `processor_cache_key'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:102:in `block in processors_cache_keys'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:102:in `map'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:102:in `processors_cache_keys'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processing.rb:159:in `resolve_processors_cache_key_uri'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets.rb:162:in `block in <module:Sprockets>'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/dependencies.rb:67:in `resolve_dependency'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:23:in `block in initialize'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:59:in `resolve_dependency'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:268:in `block in resolve_dependencies'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:268:in `map'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:268:in `resolve_dependencies'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:55:in `block in load'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:311:in `block in fetch_asset_from_dependency_cache'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:307:in `each'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:307:in `each_with_index'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:307:in `fetch_asset_from_dependency_cache'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:134:in `block in find'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `each'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:133:in `find'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/task.rb:67:in `block (3 levels) in define'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
remote: /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/task.rb:66:in `block (2 levels) in define'
remote: Tasks: TOP => assets:precompile
remote: (See full trace by running task with --trace)
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
Here's my 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
ruby "2.5.7"
gem 'rails', '5.2.4.3'
gem 'puma', '~> 3.12'
gem 'sdoc', '~> 0.4.0', group: :doc
gem "devise", ">= 4.7.1"
gem 'devise_token_auth'
gem 'activeadmin'
gem "paperclip"
gem 'aws-sdk'
gem 'dotenv-rails', :groups => [:development, :test]
gem 'bower-rails', '~> 0.11.0'
gem 'mysql2'
gem 'uglifier'
gem 'active_model_serializers', '~> 0.10.4'
gem 'nexmo', '4.8'
gem 'descriptive_statistics', '2.5.1'
# This is only for development mode, but Heroku always bundles the production group,
# so we need this here in case we're running Rails in development mode
gem 'listen', '>= 3.0.5', '< 3.2'
group :development, :test do
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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 'capybara', '~> 2.13'
gem 'selenium-webdriver'
gem 'rb-readline'
end
group :development do
# 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
group :test do
gem 'timecop'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Any ideas how I fix this? I searched and found some similar issues related to Sprockets and the sassc gem, but I'm not loading that gem so I'm not sure where to go with this info.
What ended up working for me was to add gem 'sassc-rails'
to my Gemfile. I'm guessing that codenamev's suggestion might also work because it seems like the underlying issue involves missing dependencies in legacy projects. More info here: https://github.com/sass/sassc-rails/issues/114