Heroku dyno ขัดข้องด้วยแอปข้อความ [web.1]: /usr/bin/env: ruby.exe: ไม่มีไฟล์หรือไดเรกทอรีดังกล่าว

ฉันมีแอปพลิเคชัน Rails พื้นฐานที่ทำงานบนเดสก์ท็อป Windows 8 ของฉัน (rails_12factor, ruby ​​1.9.3, rails 4, postgres) - โดยใช้ rails server - ฉันสามารถนำทางไปยังเว็บไซต์แอปพลิเคชันบนเบราว์เซอร์ในเครื่องของฉันได้ และทุกอย่างก็แสดงผลได้ดี

ฉันผลักดันแอปพลิเคชันไปที่ heroku ผ่าน git push heroku master และทุกอย่างดูเหมือนจะเป็นไปด้วยดี คำเตือนเดียวที่ฉันเห็นคือ "กำลังลบ Gemfile.lock เนื่องจากสร้างขึ้นบน Windows" กระบวนการสิ้นสุดด้วยข้อความต่อไปนี้ - "กำลังเปิดตัว... เสร็จสิ้น v9"

อย่างไรก็ตามเมื่อรัน "heroku ps" ฉันได้รับสิ่งต่อไปนี้:

=== เว็บ (1X): bin/rails server -p $PORT -e $RAILS_ENV web.1: ขัดข้อง 2013/07/12 00:42:20 (~ 4s ที่แล้ว)

ในการทำบันทึก heroku --tail ฉันพบสิ่งต่อไปนี้ซ้ำในไฟล์บันทึก - :

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

ฉันเห็นสิ่งต่าง ๆ บนเว็บที่ให้ฉันตรวจสอบ .gitignore เพื่อดูว่าเนื้อหาของโฟลเดอร์ bin ในเครื่องของฉันถูกแยกออกหรือไม่ พวกเขาจะไม่. ฉันยังเห็นคำแนะนำให้แก้ไขเนื้อหาของโฟลเดอร์ bin และลบคำว่า .exe หลังจาก ruby ​​- ฉันก็ลองเช่นกัน

แก้ไข 1: โครงการของฉันมีโฟลเดอร์ย่อยที่มีไฟล์ 3 ชุดรางและคราด นี่เป็นไฟล์เดียวที่ขึ้นต้นด้วย #!/usr/bin/env ruby ฉันยังแก้ไขบรรทัดแรกเพื่ออ่าน #!/usr/bin/env ruby*.exe* - ยังคงเห็นข้อผิดพลาดอยู่ นี่คือเนื้อหาของแต่ละไฟล์:

มัด

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

ราง

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

คราด

#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

person Nikhil George    schedule 13.07.2013    source แหล่งที่มา
comment
สิ่งนี้อาจช่วยได้: stackoverflow.com/questions/15443456/ หรือสิ่งนี้: stackoverflow.com/questions/17736328/   -  person sergio.s    schedule 21.07.2013


คำตอบ (2)


สำหรับฉันดูเหมือนว่าสคริปต์บางตัวพยายามโหลด 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'
person Ast Derek    schedule 13.07.2013
comment
ฉันไม่มีโฟลเดอร์ scripts ในโฟลเดอร์โครงการของฉัน อย่างไรก็ตาม ฉันมีโฟลเดอร์ bin ที่มีไฟล์บันเดิล ราง และคราด ทั้งหมดเริ่มต้นด้วย #!/usr/bin/env ruby: เช่น #!/usr/bin/env ruby ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) load Gem.bin_path('bundler', 'bundle') - person Nikhil George; 13.07.2013
comment
จะเกิดอะไรขึ้นหากคุณค้นหา ruby.exe ภายในโฟลเดอร์โครงการของคุณ - person Ast Derek; 13.07.2013

เดาที่นี่: คุณแก้ไขไฟล์ต้นฉบับบน Windows ดังนั้นการลงท้ายบรรทัดจึงผิด หากเป็นเช่นนั้น ตัวโหลด Linux จะพยายามโหลด "ruby\n"

เรียกใช้ dos2unix กับไฟล์ของคุณ คอมมิตใหม่และพุชไปที่ Heroku อีกครั้ง มันเกิดขึ้นกับฉันครั้งหนึ่งจริงๆ

person Nitzan Shaked    schedule 13.07.2013