Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"bundler: command not found: thin" heroku deployment rails

So my app runs perfectly on my local machine and I pushed it to github and heroku successfully but when I try opening the application in my browser, I get the following error:

Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

Then I try running

$ heroku logs

And I get the following output in my console:

2012-07-05T21:52:11+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:52:33+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2012-07-05T21:53:33+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:53:55+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2012-07-05T21:58:45+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:59:04+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2012-07-05T22:00:34+00:00 heroku[slugc]: Slug compilation started
2012-07-05T22:01:21+00:00 heroku[api]: Add shared-database:5mb add-on by [email protected]
2012-07-05T22:01:21+00:00 heroku[api]: Release v2 created by [email protected]
2012-07-05T22:01:21+00:00 heroku[api]: Add RAILS_ENV, LANG, PATH, RACK_ENV, GEM_PATH config by [email protected]
2012-07-05T22:01:21+00:00 heroku[api]: Release v3 created by [email protected]
2012-07-05T22:01:23+00:00 heroku[api]: Release v4 created by [email protected]
2012-07-05T22:01:23+00:00 heroku[api]: Deploy 23effb5 by [email protected]
2012-07-05T22:01:24+00:00 heroku[slugc]: Slug compilation finished
2012-07-05T22:01:27+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e production -p 4606`
2012-07-05T22:01:30+00:00 app[web.1]: bundler: command not found: thin
2012-07-05T22:01:30+00:00 app[web.1]: Install missing gem executables with `bundle install`
2012-07-05T22:01:31+00:00 heroku[web.1]: Process exited with status 127
2012-07-05T22:01:31+00:00 heroku[web.1]: State changed from starting to crashed
2012-07-05T22:01:31+00:00 heroku[web.1]: State changed from crashed to starting
2012-07-05T22:01:34+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e production -p 16779`
2012-07-05T22:01:35+00:00 app[web.1]: bundler: command not found: thin
2012-07-05T22:01:35+00:00 app[web.1]: Install missing gem executables with `bundle install`
2012-07-05T22:01:36+00:00 heroku[web.1]: Process exited with status 127
2012-07-05T22:01:36+00:00 heroku[web.1]: State changed from starting to crashed
2012-07-05T22:01:37+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:38+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:49+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:49+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:50+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:51+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:51+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:51+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=

I can't figure what to make of this, since this is my first time deploying to heroku and I don't know anything about web-deployment. Any help would be greatly appreciated!

like image 251
user1497531 Avatar asked Jul 05 '12 22:07

user1497531


3 Answers

For me the issue was that I added thin to my Gemfile in the development section, but once I did that heroku wanted to use it for production, but doesn't install the gems in the development section. By moving the thin gem out of the development section for use by all environments, I was able to get past this error.

Your Gemfile will probably look something like this for a Rails app:

source 'https://rubygems.org'

gem 'rails'
gem 'heroku'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem 'thin'

# more gems

Heroku recommends thin for a production web server anyway.

Update (2012-05-16): In that Rails 3 webserver link above Heroku now recommends unicorn. thin will still work, but you may want to consider switching over to unicorn.

like image 74
mmrobins Avatar answered Oct 15 '22 04:10

mmrobins


You're probably missing a gem in your Gemfile. Make sure that everything your application needs is specified in the Gemfile, as opposed to locally doing a "gem install ". To verify, you could install RVM, create a gemset specifically for your app, run "bundle install" in your app dir, and then see if your app runs locally. If it does not run, a gem is definitely missing.

like image 30
steakchaser Avatar answered Oct 15 '22 04:10

steakchaser


It appears that heroku is trying to start Thin in the absence of a Procfile to tell it otherwise. As noted above, Thin is not installed in the Gemfile, hence the error. Taking Thin out of the development group will work, as noted above.

If you want to get heroku to start Unicorn instead of Thin, set up your config/unicorn.rb and your Procfile as indicated here: https://devcenter.heroku.com/articles/rails-unicorn

The Procfile contents for Unicorn are listed in the link above, and more info about the Procfile (just a file called 'Procfile' in the root of your application) here: https://devcenter.heroku.com/articles/procfile

like image 25
nachbar Avatar answered Oct 15 '22 02:10

nachbar