Problems deploying to Heroku

Have been working on an app with hotwire gem installed. Im using stimulusjs from the app/assets/javascripts folder and also have webpacker installed with turbolinks disabled. I tried to push my code to heroku and got this error everytime I tried to follow other stack overflows for the error but didnt work im thinking its something to do with hotwire, if anyone could help me out and maybe Im missing something obvious

 Errno::ENOENT: No such file or directory @ dir_initialize - /tmp/build_d1d04b1c_/app/assets/javascripts/libraries
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/stimulus-rails-0.1.1/lib/stimulus/importmap_helper.rb:11:in `block in importmap_list_from'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/stimulus-rails-0.1.1/lib/stimulus/importmap_helper.rb:7:in `each'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/stimulus-rails-0.1.1/lib/stimulus/importmap_helper.rb:7:in `flat_map'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/stimulus-rails-0.1.1/lib/stimulus/importmap_helper.rb:7:in `importmap_list_from'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/stimulus-rails-0.1.1/lib/stimulus/importmap_helper.rb:3:in `importmap_list_with_stimulus_from'
   /tmp/build_d1d04b1c_/app/assets/javascripts/importmap.json.erb:3:in `call'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/erb_processor.rb:34:in `call'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/erb_processor.rb:13:in `call'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:81:in `find_asset'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:88:in `find_all_linked_assets'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `block in synchronize'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:19:in `execute'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/promise.rb:563:in `block in realize'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:363:in `run_task'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `block (3 levels) in create_worker'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `loop'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `block (2 levels) in create_worker'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `catch'
   /tmp/build_d1d04b1c_/vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block in create_worker'
   Tasks: TOP => assets:precompile
   (See full trace by running task with --trace)
   zlib(finalizer): the stream was freed prematurely.

!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app.
! Push failed

It looks that app/assets/javascripts/libraries is required by app/assets/javascripts/importmap.json.erb but it doesn’t exist in the repo. You can either remove that directory from the importmap file or add it to the repo:

echo > app/assets/javascripts/libraries/.gitkeep
git add app/assets/javascripts/libraries
git commit -m "Adding app/assets/javascripts/libraries
2 Likes

Wow i didn’t even think about that it wasn’t getting pushed to github at all thank you

1 Like

it works, lifesaver !

2 Likes