2

Just deployed an app, but the message I get online is:

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."

Here's a sample from the logs, but I cant figure out what's wrong.

$ heroku logs
←[36m2013-08-25T20:08:28.849427+00:00 heroku[web.1]:←[0m State changed from cras
 hed to starting
←[36m2013-08-25T20:08:34.637820+00:00 heroku[web.1]:←[0m Starting process with c
ommand `bin/rails server -p 47444 -e $RAILS_ENV`
←[36m2013-08-25T20:08:35.451207+00:00 app[web.1]:←[0m /usr/bin/env: ruby.exe: No
 such file or directory
←[36m2013-08-25T20:08:37.130015+00:00 heroku[web.1]:←[0m Process exited with sta
tus 127
←[36m2013-08-25T20:08:37.144978+00:00 heroku[web.1]:←[0m State changed from star
 ting to crashed
 ←[36m2013-08-25T20:08:44.946201+00:00 heroku[web.1]:←[0m Error R99 (Platform err
 or) -> Failed to launch the dyno within 10 seconds
←[36m2013-08-25T20:08:44.946616+00:00 heroku[web.1]:←[0m Stopping process with S
IGKILL
←[36m2013-08-25T20:18:37.449495+00:00 heroku[web.1]:←[0m State changed from cras
hed to starting
 ←[36m2013-08-25T20:18:41.670955+00:00 heroku[web.1]:←[0m Starting process with c
ommand `bin/rails server -p 24333 -e $RAILS_ENV`
←[36m2013-08-25T20:18:42.269982+00:00 app[web.1]:←[0m /usr/bin/env: ruby.exe: No
 such file or directory
←[36m2013-08-25T20:18:43.430802+00:00 heroku[web.1]:←[0m Process exited with sta
 tus 127
←[36m2013-08-25T20:18:43.443400+00:00 heroku[web.1]:←[0m State changed from star
ting to crashed
←[33m2013-08-25T20:19:48.199235+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/favicon.ico host=radiant-lake-2999.herokuapp.com
 fwd="82.28.231.27" dyno= connect= service= status=503 bytes=

After trying all the suggestions ive got so far and all the changes done accordingly this is what i get in heroku logs:

←[36m2013-08-27T21:34:49.397195+00:00 app[web.1]:←[0m F, [2013-08-27T20:58:04.948189    #2] FATAL -- :
←[36m2013-08-27T21:34:49.397195+00:00 app[web.1]:←[0m ActionController::RoutingError        (No route matches [GET] "/"):
←[36m2013-08-27T22:36:51.045269+00:00 app[web.1]:←[0m [2013-08-27 22:36:51] ERROR     SignalException: SIGTERM
←[36m2013-08-27T22:36:51.045269+00:00 app[web.1]:←[0m   /app/vendor/ruby- 1.9.3/lib/ruby/1.9.1/webrick/server.rb:98:in `select'
←[36m2013-08-27T22:37:01.918797+00:00 heroku[web.1]:←[0m Error R12 (Exit timeout) -  >Atleastone process failed to exit within 10 seconds of SIGTERM
←[36m2013-08-27T22:37:01.918996+00:00 heroku[web.1]:←[0m Stopping remaining processes with SIGKILL
naktinis
  • 41
  • 1
  • 4
  • Sounds like [this](http://stackoverflow.com/a/16268193/477878)...? – Joachim Isaksson Aug 25 '13 at 20:59
  • Sorry about formatting of the post just getting used to it. I tried that just now and my app went missing... "The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved." I did git add and commit and pushed to gut hub and heroku also restarted the heroku server... – naktinis Aug 25 '13 at 21:27

4 Answers4

13

You need to change in your application first line of the 3 files: bin/bundle bin/rails bin/rake

Change

#!/usr/bin/env ruby.exe

to

#!/usr/bin/env ruby

That's the error!

Than you can normally do:

heroku run rake db:migrate
Mini John
  • 7,855
  • 9
  • 59
  • 108
  • 1
    Just tried that and still nothing... i still get the same missing page window... updated my post with more info. im really stuck here... – naktinis Aug 28 '13 at 13:44
2

TL;DR

This question is not an exact duplicate of windows heroku run rake db:migrate error "/usr/bin/env: ruby.exe: No such file or directory", but the answer is largely the same: use #!/usr/bin/env ruby instead.

Shebang is Wrong

The shebang is wrong. Heroku uses an EC2 Linux instance, not Windows, as its underlying OS. You can validate this by running heroku run bash and then typing uname -a at the command line.

On Linux, your shebang needs to contain either the fully-qualified path to a Ruby interpreter, or the fully-qualified path to env followed by the interpreter to search for in the PATH environment variable. For example, the following are both valid on the Heroku Cedar stack:

  • #!/app/bin/ruby
  • #!/usr/bin/env ruby

In general, the latter is considered the best approach for Rails apps, because it's the most portable. Windows generally uses file associations, and will ignore the shebang line unless you're running under a POSIX layer like Cygwin, so you should probably use the "env trick" for all your cross-platform source files unless you have specific needs.

Shebang Targets

The Cedar stack has a number of other copies of Ruby in the PATH. Consider the following:

$ heroku run "bash -c 'which -a ruby'"
Running `bash -c 'which -a ruby'` attached to terminal... up, run.9433
/app/bin/ruby
bin/ruby
/usr/local/bin/ruby

The first two are actually symlinks to ../vendor/ruby-2.0.0/bin/ruby, so there are really four possible shebang targets, but /app/bin/ruby is the first one in the PATH.

Make your life simple. Just ignore the long explanation above, and use #!/usr/bin/env ruby.

Community
  • 1
  • 1
Todd A. Jacobs
  • 81,402
  • 15
  • 141
  • 199
  • I did as advised and still nothing... it still says the page im looking for is missing or does not exist... im lost now... – naktinis Aug 26 '13 at 00:02
  • 1
    @naktinis You clearly have other problems besides the one in your original question. You may need to do some troubleshooting and then ask *new* questions about your other issues. As a practical matter, note that some of your problems would probably go away if you developed on the same application stack (e.g. OS, web server, and interpreter) as your target platform. Your mileage may vary. – Todd A. Jacobs Aug 26 '13 at 00:15
  • heres my github repo https://github.com/eradication/Frequency might this help?? I've tried everything and still the same tho in the logs i dont see any errors anymore... – naktinis Aug 27 '13 at 20:12
  • I've spent whole day yesterday trying to sort this one out and still no luck... i've added more logs these are the ones i get now after aplying all the suggested changes. – naktinis Aug 28 '13 at 13:42
  • This answer helped, as I still had the .exe present from originally creating this app on a windows machine. However, this didn't fully fix my issue as I still got the same error. I then noticed that I had a carriage return character on the first line (leftover from Windows I guess). I used `dos2unix` to remove this carriage return from my `bin/*` files and then commited and pushed this to heroku. This is what fixed it for me. – Lyrical Jul 23 '15 at 14:56
1

Run the following rake command

$ rake rails:update:bin
$ git status 
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   bin/bundle
    modified:   bin/rails
    modified:   bin/rake
    modified:   bin/setup
    modified:   bin/update
$ git add bin/
$ git commit -m 'updated bin'
$ git push heroku master 

Now, It should be working.

aashish
  • 2,453
  • 1
  • 21
  • 19
0

As of heroku-22, ruby is no longer included by default:

The stack no longer includes a system Ruby installation. This will not affect the vast majority of users, since Ruby apps will use the Ruby installation provided by the Ruby buildpack.

If you're seeing the above error immediately after upgrading to heroku-22, you'll need to add the Ruby buildpack

RvPr
  • 1,074
  • 1
  • 9
  • 26