3

I am trying to follow Michael Hartl's rails tutorial adding authentication step 7.29 (http://ruby.railstutorial.org/chapters/sign-up#top). My project works locally but I get "an error occurred in the application and your page could not be served" when I try deploying to heroku. These are my log errors:

     heroku[api]: Starting process with command `bundle exec rake db:migrate` by connorleech@gmail.com
     heroku[run.1285]: Awaiting client
     heroku[run.1285]: Starting process with command `bundle exec rake db:migrate`
     heroku[run.1285]: State changed from starting to up
     heroku[run.1285]: Process exited with status 0
     heroku[run.1285]: State changed from up to complete
     heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=jason-shark-rails-project.herokuapp.com fwd="41.74.174.50" dyno= connect= service= status=503 bytes=
     heroku[web.1]: State changed from crashed to starting
     heroku[web.1]: Starting process with command `bin/rails server -p 10431 -e $RAILS_ENV`
     app[web.1]: bash: bin/rails: No such file or directory
     heroku[web.1]: Process exited with status 127
     heroku[web.1]: State changed from starting to crashed
     heroku[web.1]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
     heroku[web.1]: Stopping process with SIGKILL

It seems I may be missing something in my project in order to deploy it.. bash: bin/rails: No such file or directory

Why does my app work locally but not deploy to heroku?

Connor Leech
  • 18,052
  • 30
  • 105
  • 150
  • See this thread: http://stackoverflow.com/questions/17704754/heroku-app-crash-h10-bash-bin-rails-no-such-file-or-directory – konsolebox Sep 01 '13 at 12:47
  • Your question is actually a duplicate of it so I think it's better to close this. – konsolebox Sep 01 '13 at 12:51
  • This one is helpful too: http://stackoverflow.com/questions/17583439/bin-rails-no-such-file-or-directory-w-ruby-2-rails-4-on-heroku and the information from the heroku site (https://devcenter.heroku.com/articles/rails4) suggests running rake rails:update:bin However this still does not work for me :( – Connor Leech Sep 01 '13 at 13:01
  • And did you try `heroku config:set PATH=bin:vendor/bundle/ruby/2.0.0/bin:/usr/local/bin:/usr/bin:/bin`? The section `ruby/2.0.0/` should vary depending on the one existing on your machine. – konsolebox Sep 01 '13 at 14:04

2 Answers2

5

Rails 4 project had a /bin directory, unlike some older Rails 3 projects I had cloned. /bin contains 3 files, bundle, rails, and rake, but these weren't making it to Heroku because I had bin in my global .gitignore file.

This is a pretty common ignore rule if you work with Git and other languages (Java, etc.), so to fix this:

  1. Remove bin from ~/.gitignore
  2. Run bundle install
  3. Commit your changes with git add . and git commit -m "Add bin back"
  4. Push your changes to Heroku with git push heroku master
Mostafa Hussein
  • 11,063
  • 3
  • 36
  • 61
0

I had a similar problem, for some reason the /bin folder was not copying to my GitHub repo (check yours?). After trying many other solutions unsuccessfully, I ran git add bin and that let me push the bin folder to GitHub. I'm still unsure why I had to make this exception for the bin folder specifically. Running Ruby v2, Rails v4, on Linux.

cfinnerty
  • 1
  • 1