2.1 RC Heroku deploy issue

I’m trying out the Hanami 2.1 release candidate, and when I push to Heroku, I get the following error. Has anyone else seen this?

-----> Precompiling assets
       Running: rake assets:precompile
       rake aborted!
       Hanami::CLI::HanamiExecError: `bundle exec hanami assets compile' failed
       
       
       "bundler: command not found: hanami\nInstall missing gem executables with `bundle install`"
       /tmp/build_407d9f88/vendor/bundle/ruby/3.2.0/gems/hanami-cli-2.1.0.rc1/lib/hanami/cli/bundler.rb:94:in `block in hanami_exec'
       <internal:kernel>:90:in `tap'
       /tmp/build_407d9f88/vendor/bundle/ruby/3.2.0/gems/hanami-cli-2.1.0.rc1/lib/hanami/cli/bundler.rb:93:in `hanami_exec'
       /tmp/build_407d9f88/vendor/bundle/ruby/3.2.0/gems/hanami-2.1.0.rc1/lib/hanami/rake_tasks.rb:57:in `run_hanami_command'
       /tmp/build_407d9f88/vendor/bundle/ruby/3.2.0/gems/hanami-2.1.0.rc1/lib/hanami/rake_tasks.rb:47:in `block (3 levels) in <top (required)>'
       /tmp/build_407d9f88/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
       Tasks: TOP => assets:precompile
       (See full trace by running task with --trace)

@aaricpittman Thanks for reporting this problem.

From the stack trace, it seems like the hanami executable is missing.
Are you able to tell if the hanami-cli gem was installed?

If so, are you able to log in the Heroku console (not app console), and run bundle exec hanami assets compile --help?

I see remote: Installing hanami-cli 2.1.0.rc1 in the output from pushing to Heroku. However, in the Heroku console, the assets command isn’t available, probably because the build failed.

I overrode the assets:precompile task and explicitly called system "bundle exec hanami assets compile". Below is the output.

remote: -----> Precompiling assets
remote:        Running: rake assets:precompile
remote:        bundler: failed to load command: hanami (/tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/bin/hanami)
remote:        /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/open3.rb:222:in `spawn': No such file or directory - npm (Errno::ENOENT)
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/open3.rb:222:in `popen_run'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/open3.rb:103:in `popen3'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/gems/hanami-cli-2.1.0.rc1/lib/hanami/cli/system_call.rb:94:in `block in call'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler.rb:419:in `block in with_unbundled_env'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler.rb:665:in `with_env'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler.rb:419:in `with_unbundled_env'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/gems/hanami-cli-2.1.0.rc1/lib/hanami/cli/system_call.rb:93:in `call'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/gems/hanami-cli-2.1.0.rc1/lib/hanami/cli/commands/app/assets/command.rb:26:in `call'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/gems/hanami-cli-2.1.0.rc1/lib/hanami/cli/commands/app/command.rb:40:in `call'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/gems/hanami-cli-2.1.0.rc1/lib/hanami/cli/commands/app/command.rb:40:in `call'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/gems/dry-cli-1.0.0/lib/dry/cli.rb:116:in `perform_registry'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/gems/dry-cli-1.0.0/lib/dry/cli.rb:65:in `call'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/gems/hanami-cli-2.1.0.rc1/exe/hanami:11:in `<top (required)>'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/bin/hanami:25:in `load'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/bin/hanami:25:in `<top (required)>'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/cli.rb:492:in `exec'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.10/libexec/bundle:45:in `block in <top (required)>'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
remote:        	from /tmp/build_7e87dffb/vendor/ruby-3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.10/libexec/bundle:33:in `<top (required)>'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/bin/bundle:23:in `load'
remote:        	from /tmp/build_7e87dffb/vendor/bundle/ruby/3.2.0/bin/bundle:23:in `<main>'

I’ve got it building by:

  1. Adding the heroku/nodejs buildpack before the heroku/ruby buildpack.
  2. Overriding the assets:precompile task in my Rakefile with the following.
namespace :assets do
  task precompile: :environment do
    system "npm install"
    system "bundle exec hanami assets compile"
    exit
  end
end

Without adding the heroku/nodejs buildpack, node gets installed, but npm isn’t available. (Which I find confusing)

Without explicitly calling npm install, it builds but I get an error about missing manifest when visiting the apps URL. I checked, and the manifest file is not there.

Also, I’m getting a 404 for the assets. I checked the directory via the Heroku console and everything looks correct.

Never mind about the assets. Realized I needed to set config.assets.serve to true

1 Like