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
4

2 回答 2

0

这里有一个猜测:您在 Windows 上编辑了源文件,所以行尾是错误的。如果是,Linux 加载程序将尝试加载“ruby\n”。

在您的文件上运行 dos2unix,重新提交并重新推送到 Heroku。它实际上发生在我身上一次。

于 2013-07-13T17:50:32.183 回答
0

在我看来,某些脚本正试图ruby.exe通过 shebang 加载。

看一下yourproject/script/rails,我的在 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'
于 2013-07-13T04:17:58.170 回答