1

I have a basic rails application which works on my windows 8 desktop (rails_12factor, ruby 1.9.3, rails 4, postgres) - using rails server - I am able to navigate to the application website on my local browser and everything renders fine.

I push the application up to heroku via git push heroku master and everything seems to go fine. The only warning I see is "Removing Gemfile.lock because it was generated on Windows." The process ends with the following message - "Launching... done, v9".

However on running "heroku ps" I get the following:

=== web (1X): bin/rails server -p $PORT -e $RAILS_ENV web.1: crashed 2013/07/12 00:42:20 (~ 4s ago)

On doing heroku logs --tail, I get the following being repeated in the log files - :

heroku[web.1]: Starting process with command `bin/rails server -p 16041 -e $RAILS_ENV`
app[web.1]: /usr/bin/env: ruby.exe: 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

...

heroku[web.1]: Process exited with status 127
heroku[web.1]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds

I saw stuff on the web that had me check .gitignore to see if the contents of my local bin folder were getting excluded. They are not. I also saw suggestions to edit the contents of the bin folder and remove the word .exe after ruby - I tried that as well.

EDIT 1: My project has a subfolder bin, with 3 files bundle, rail and rake. These are the only files which start with #!/usr/bin/env ruby. I also edited the first line to read #!/usr/bin/env ruby*.exe* - the error was still seen. Here is the content of each file :

bundle

#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

rails

#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application',  __FILE__)
require_relative '../config/boot'
require 'rails/commands'

rake

#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run
Nikhil George
  • 471
  • 7
  • 9
  • 1
    This might help: http://stackoverflow.com/questions/15443456/windows-heroku-run-rake-dbmigrate-error-usr-bin-env-ruby-exe-no-such-file-o Or this: http://stackoverflow.com/questions/17736328/ruby-on-rails-tutorial-by-michael-hartl-chapter-2-exercise-demo-app-app-works – sergio.s Jul 20 '13 at 22:02

2 Answers2

0

It seems to me that some script is trying to load ruby.exe via a shebang.

Take a look at yourproject/script/rails, mine looks like this under Mac OS 10.6:

#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.

APP_PATH = File.expand_path('../../config/application',  __FILE__)
require File.expand_path('../../config/boot',  __FILE__)
require 'rails/commands'
Ast Derek
  • 2,739
  • 1
  • 20
  • 28
  • I dont have a folder `scripts` in my project folder. However, I have a bin folder with files bundle, rails and rake. They all start with `#!/usr/bin/env ruby`: e.g. `#!/usr/bin/env ruby ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) load Gem.bin_path('bundler', 'bundle')` – Nikhil George Jul 13 '13 at 06:03
  • What if you search for `ruby.exe` inside your project folder – Ast Derek Jul 13 '13 at 17:54
0

A guess here: you edited the source files on Windows, so the line endings are wrong. If they are, the Linux loader will try to load "ruby\n".

Run dos2unix on your files, re-commit and re-push to Heroku. It actually happened to me once.

Nitzan Shaked
  • 13,460
  • 5
  • 45
  • 54