本文介绍了“bin / rails:没有这样的文件或目录” w / Ruby 2& Rails 4在Heroku上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在遵循Michael Hartl的Rails 4 Beta 版本的 ,我的应用程序无法在Heroku上启动,但在本地使用 bundle exec rails rails 。检查 heroku logs -t 显示以下错误:

While following the Rails 4 Beta version of Michael Hartl's Ruby on Rails Tutorial, my app fails to start on Heroku, but runs fine locally with bundle exec rails server. Checking heroku logs -t reveals the following error:

$ 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

如果我 heroku运行bash 并检查 bin 目录,我可以看到存在 a rails 可执行文件:

If I heroku run bash and check the bin directory, I can see that there is not a rails executable:

~$ ls bin
erb  gem  irb  node rdoc  ri  ruby  testrb

我做错了什么?我仔细地跟着教程。

What have I done wrong? I followed the tutorial exactly.

推荐答案

如果您使用Git和其他语言(Java等),这是一个非常常见的忽略规则,因此修复此问题:

This is a pretty common ignore rule if you work with Git and other languages (Java, etc.), so to fix this:


  1. 〜/ .gitignore bin >
  2. 运行 bundle install

  3. 使用 git提交
    更改添加。
    git commit -m将bin添加回来

  4. code> git push heroku master

  1. Remove bin from ~/.gitignore
  2. Run bundle install
  3. Commit yourchanges with git add . and git commit -m "Add bin back"
  4. Push your changes to Heroku with git push heroku master

这篇关于“bin / rails:没有这样的文件或目录” w / Ruby 2& Rails 4在Heroku上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 01:09