heroku: bash: bundle: command not found

此生再无相见时 提交于 2019-12-01 16:26:57

问题


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?


回答1:


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.




回答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



来源:https://stackoverflow.com/questions/13019906/heroku-bash-bundle-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!