heroku: bash: bundle: command not found
Asked Answered
P

2

6

I am porting a Heroku app from Aspen to Cedar stack at Heroku, following their instructions.

I'm at the last deploy step. I get this error:

    2012-10-22T11:23:53+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -p 40310 -e production`
2012-10-22T11:23:54+00:00 app[web.1]: bash: bundle: command not found

I can't see how I can be responsible for telling the Heroku stack where bundle is, or providing it, since bundler is used by it for exactly this job. This command is specified in the Procfile for the app:

web: bundle exec thin start -p $PORT -e $RACK_ENV

Another similar question on stackoverflow suggests that this happens if the app is pushed to Heroku without a Procfile initially, so Heroku gets the wrong idea about what kind of app it is. That poster deleted his app and created a new one and reported success. However, the effort involved in deleting and recreating my ported app is high. Is there some way I can fix this rather than start over?

Pigpen answered 22/10, 2012 at 21:8 Comment(1)
In my case, specify the latest Ruby which worked with my app in my Gemfile solved the issue.Pinup
H
5

Heroku's slug build process must have changed with regard to ruby 1.8.7 apps. I'm guessing they started bundling to 1.8 paths instead of 1.9.1 for 1.8 apps. My previously working app stopped working after I tried to push a new revision.

Here's what got it working again:

heroku config:add PATH=bin:vendor/bundle/1.8/bin:/usr/local/bin:/usr/bin:/bin GEM_PATH=vendor/bundle/1.8

I took these paths from a newly created app using the same git repository as I used before.

EDIT: Turns out that heroku published a devcenter article Changing Ruby Version Breaks Path that specifies paths for various ruby versions.

Handmade answered 8/11, 2012 at 19:12 Comment(1)
Further insight - the path is now (maybe in response to my Heroku ticket) set correct IF the very first time you push the bundle with a Gemfile, the Gemfile has the correct ruby version in it. It will (understandably) assume 1.9.1 if you don't specify. Having got it wrong, this is the correct path (I wrongly guessed 1.8.7 the first time, based on the 1.9.1 that I saw!)Pigpen
G
2

I had the same issue and I solved it by setting the correct heroku config variables

$ heroku config
=== xxxx Config Vars
DATABASE_URL:                  postgres://(...)
GEM_PATH:                      vendor/bundle/ruby/1.9.1
HEROKU_POSTGRESQL_CRIMSON_URL: postgres://(...)
LANG:                          en_US.UTF-8
PATH:                          bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
PGBACKUPS_URL:                 https://(...)
RACK_ENV:                      production
RAILS_ENV:                     production

you can create an empty rails app, push it to heroku and check the variables it automatically set, then copy (and adapt) them to your application

Guiscard answered 26/10, 2012 at 17:45 Comment(3)
Thanks! My config looks the same as yours. It's a bit odd, actually, since mine is a 1.8.7 app, but I can't see why that would make a difference to whether bundle is on the path though.Pigpen
Hey - can you mention what it was that you had to change, specifically, that made it work?Pigpen
You should adapt you config to ruby 1.8.7 I guess that what made it work was changing PATH and GEM_PATH try changing 1.9.1 by 1.8.7 or check config values of a new created application (with ruby 1.8.7)Tudela

© 2022 - 2024 — McMap. All rights reserved.