Heroku上的"bin/rails:没有这样的文件或目录"w/Ruby 2&Rails 4

Jus*_*ick 57 ruby ruby-on-rails heroku ruby-2.0 ruby-on-rails-4

在遵循Michael Hartl的Ruby on Rails教程的Rails 4 Beta版本时,我的应用程序无法在Heroku上启动,但在本地运行良好.检查显示以下错误:bundle exec rails serverheroku logs -t

$ heroku[web.1]: State changed from crashed to starting
$ heroku[web.1]: Starting process with command `bin/rails server 
-p 33847 -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
Run Code Online (Sandbox Code Playgroud)

如果我heroku run bash和检查bin目录,我可以看到,有没有一个rails可执行文件:

~$ ls bin
erb  gem  irb  node rdoc  ri  ruby  testrb
Run Code Online (Sandbox Code Playgroud)

我做错了什么?我完全按照教程.

小智 103

自从我升级到rails 4.0.0后,我也遇到了这个问题

运行此命令

rake rails:update:bin
Run Code Online (Sandbox Code Playgroud)

您可以访问此处获取更多信息 https://devcenter.heroku.com/articles/rails4

  • 对于那些从Rails 3等升级的人的好信息,但问题中的问题发生在新的应用程序中.此外,如果您有这些目录gitignored,这将无法帮助您,因为他们仍然不会将git推送到Heroku. (2认同)
  • 转移到Rails 4.0.0,这绝对是个问题. (2认同)

Jus*_*ick 39

经过一段时间的努力,我注意到我的Rails 4项目有一个/bin目录,不像我克隆的一些旧的Rails 3项目. /bin3个文件bundle,rails以及rake,但这些都没有做它对Heroku的,因为我有bin我的全球.gitignore文件.

如果你使用Git和其他语言(Java等),这是一个非常常见的忽略规则,所以要解决这个问题:

  1. bin从中移除~/.gitignore
  2. bundle install
  3. 使用git add .和提交您的更改git commit -m "Add bin back"
  4. 用你的更改推送到Heroku git push heroku master

  • 在Heroku上运行Rails4应用程序有一个Heroku指南 - https://devcenter.heroku.com/articles/rails4 (3认同)

Kir*_*ela 9

步骤:

  1. bundle config --delete bin #关闭Bundler的存根生成器

  2. rake rails:update:bin #使用新的Rails 4可执行文件

  3. git add bin or git add bin -f #添加bin /到源代码管理

  4. git commit -a -m "you commit message"

  5. git push heroku master

  6. heroku open