LoginSignup
1
0

More than 1 year has passed since last update.

LoadError: cannot load such file -- coffee_scriptをRails.application.config.assets.precompile = []で対応しました。

Posted at

LoadError: cannot load such file -- coffee_script

概要

Herokuへのアップロードをした時に、下記エラーが発生しました。
ログを見てみますと、をLoadError: cannot load such file -- coffee_scriptが発生しております。

remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        LoadError: cannot load such file -- coffee_script
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:332:in `require'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:332:in `block in require'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:299:in `load_dependency'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:332:in `require'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/autoload/coffee_script.rb:2:in `<top (required)>'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:332:in `require'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:332:in `block in require'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:299:in `load_dependency'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.5/lib/active_support/dependencies.rb:332:in `require'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/coffee_script_processor.rb:17:in `cache_key'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/coffee_script_processor.rb:23:in `call'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:84:in `call_processor'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:65:in `reverse_each'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:65:in `call_processors'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:22:in `block in <class:CompositeProcessor>'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:33:in `call'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:84:in `call_processor'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:65:in `reverse_each'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:65:in `call_processors'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:182:in `load_from_unloaded'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:59:in `block in load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:43:in `load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/cached_environment.rb:44:in `load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/bundle.rb:27:in `call'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:84:in `call_processor'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:65:in `reverse_each'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:65:in `call_processors'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:182:in `load_from_unloaded'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:59:in `block in load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:43:in `load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/cached_environment.rb:44:in `load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/bundle.rb:32:in `block in call'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/bundle.rb:31:in `call'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:84:in `call_processor'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:65:in `reverse_each'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/processor_utils.rb:65:in `call_processors'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:182:in `load_from_unloaded'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:59:in `block in load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/loader.rb:43:in `load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/cached_environment.rb:44:in `load'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/base.rb:81:in `find_asset'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/base.rb:88:in `find_all_linked_assets'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `each'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `to_a'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.3/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `block in synchronize'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `synchronize'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `synchronize'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:19:in `execute'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/promise.rb:564:in `block in realize'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:363:in `run_task'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `block (3 levels) in create_worker'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `loop'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `block (2 levels) in create_worker'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `catch'
remote:        /tmp/build_17b86f88/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block in create_worker'
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
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: a96a1eefe781fa48c693b075bb86639d2a23288f
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version a96a1eefe781fa48c693b075bb86639d2a23288f
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !	Push rejected to decoy-sevens.
remote: 
To https://git.heroku.com/decoy-sevens.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/decoy-sevens.git'

なのでGemfileからcoffee-script関係を排除し、 config/initializers/assets.rbに以下を追記します。

# Be sure to restart your server when you modify this file.

# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'

# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
Rails.application.config.assets.precompile = [] 

上記はプリコンパイルさせるファイルはありませんとしております。
ここでCoffee-scriptを排除すれば良いかと思います。

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0