Using Bower and Rails in Heroku

This seems pretty easy until you realize that Bower (a Node.js package) is not available in the Heroku Ruby build pack. The gem bower-rails allows for easy Bower integration into Rails, but it won't work out of the box in Heroku.

Solution: add execjs

The Ruby buildpack has a magic behavior where if it detects the execjs gem, it will bundle Node.js with the build. This should make it work.

gem 'execjs'

Alternative solution

Use the Multi buildpack to combine Ruby and Node buildpacks.

heroku config:add BUILDPACK_URL=
# vim .buildpacks

I recommend locking the versions (#v60) to ensure that you get versions that interoperate together (in case one upgrades and breaks interoperability).

The last pack defined (Ruby in this case) is the "main" one that defines the process types (web, console, etc).