“bin/rails: No such file or directory” w/ Ruby 2 & Rails 4 on Heroku

前端 未结 7 610
走了就别回头了
走了就别回头了 2020-11-28 07:14

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

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 07:53

    After struggling with this for a bit, I noticed that my Rails 4 project had a /bin directory, unlike some older Rails 3 projects I had cloned. /bin contains 3 files, bundle, rails, and rake, but these weren't making it to Heroku because I had bin in my global .gitignore file.

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

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

提交回复
热议问题