问题描述
在遵循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:
- 从
〜/ .gitignore
bin > - 运行
bundle install
- 使用
git提交
和
更改添加。git commit -m将bin添加回来
- code> git push heroku master
- Remove
bin
from~/.gitignore
- Run
bundle install
- Commit yourchanges with
git add .
andgit commit -m "Add bin back"
- Push your changes to Heroku with
git push heroku master
这篇关于“bin / rails:没有这样的文件或目录” w / Ruby 2& Rails 4在Heroku上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!