Skip to content

/usr/bin/env: ‘ruby_executable_hooks’: No such file or directory on Heroku after removing this gem #65

Description

@schneems

Hello 👋 . When someone has this gem in their Gemfile, and they push to Heroku it causes executables to be generated with this shebang line:

#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'ZenTest' is installed as part of a gem, and
# this file is here to facilitate running it.

The gems are cached between builds. If the application later removes the rubygems-bundler gem then they will get this error:

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.4.5
-----> Installing dependencies using bundler 1.15.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       /usr/bin/env: ‘ruby_executable_hooks’: No such file or directory
       Bundler Output: /usr/bin/env: ‘ruby_executable_hooks’: No such file or directory
 !
 !     Failed to install gems via Bundler.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

I'm not sure if there's any kind of a technical way to solve this issue, however I wanted to document this failure mode so others might find it.

The solution is to clear the build cache on Heroku, this can be done by changing the Ruby version or manually via https://github.com/heroku/heroku-repo through the heroku repo:purge_cache command. Note though that this will also clear older asset versions as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions