【问题标题】:"bundler: command not found: thin" heroku deployment rails“捆绑器:找不到命令:瘦”heroku 部署轨道
【发布时间】:2012-07-05 22:21:38
【问题描述】:

所以我的应用程序在我的本地机器上完美运行,我成功地将它推送到 github 和 heroku,但是当我尝试在浏览器中打开应用程序时,我收到以下错误:

Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

然后我尝试运行

$ heroku logs

我在控制台中得到以下输出:

2012-07-05T21:52:11+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:52:33+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2012-07-05T21:53:33+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:53:55+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2012-07-05T21:58:45+00:00 heroku[slugc]: Slug compilation started
2012-07-05T21:59:04+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2012-07-05T22:00:34+00:00 heroku[slugc]: Slug compilation started
2012-07-05T22:01:21+00:00 heroku[api]: Add shared-database:5mb add-on by aayushgopaldawra@gmail.com
2012-07-05T22:01:21+00:00 heroku[api]: Release v2 created by username@gmail.com
2012-07-05T22:01:21+00:00 heroku[api]: Add RAILS_ENV, LANG, PATH, RACK_ENV, GEM_PATH config by aayushgopaldawra@gmail.com
2012-07-05T22:01:21+00:00 heroku[api]: Release v3 created by username@gmail.com
2012-07-05T22:01:23+00:00 heroku[api]: Release v4 created by username@gmail.com
2012-07-05T22:01:23+00:00 heroku[api]: Deploy 23effb5 by username@gmail.com
2012-07-05T22:01:24+00:00 heroku[slugc]: Slug compilation finished
2012-07-05T22:01:27+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e production -p 4606`
2012-07-05T22:01:30+00:00 app[web.1]: bundler: command not found: thin
2012-07-05T22:01:30+00:00 app[web.1]: Install missing gem executables with `bundle install`
2012-07-05T22:01:31+00:00 heroku[web.1]: Process exited with status 127
2012-07-05T22:01:31+00:00 heroku[web.1]: State changed from starting to crashed
2012-07-05T22:01:31+00:00 heroku[web.1]: State changed from crashed to starting
2012-07-05T22:01:34+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e production -p 16779`
2012-07-05T22:01:35+00:00 app[web.1]: bundler: command not found: thin
2012-07-05T22:01:35+00:00 app[web.1]: Install missing gem executables with `bundle install`
2012-07-05T22:01:36+00:00 heroku[web.1]: Process exited with status 127
2012-07-05T22:01:36+00:00 heroku[web.1]: State changed from starting to crashed
2012-07-05T22:01:37+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:38+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:49+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:49+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:50+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:51+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:51+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-05T22:01:51+00:00 heroku[router]: Error H10 (App crashed) -> GET glowing-robot-9319.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=

我不知道该怎么做,因为这是我第一次部署到 Heroku,而且我对网络部署一无所知。任何帮助将不胜感激!

【问题讨论】:

  • gem 'pg' gem 'taps' 添加到 **Gemfile ** 并捆绑安装。并将代码部署到heroku并重新启动服务器。

标签: ruby-on-rails heroku


【解决方案1】:

对我来说,问题是我在开发部分向我的 Gemfile 添加了 thin,但是一旦我这样做了,heroku 就想将它用于生产,但没有在开发部分安装 gem。通过将瘦 gem 移出开发部分以供所有环境使用,我能够克服这个错误。

对于 Rails 应用程序,您的 Gemfile 可能看起来像这样:

source 'https://rubygems.org'

gem 'rails'
gem 'heroku'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem 'thin'

# more gems

无论如何,Heroku recommends thin 用于生产 Web 服务器。

更新 (2012-05-16):在 Heroku 上方的 Rails 3 网络服务器链接中,现在 recommends unicorn。 thin 仍然可以,但您可能需要考虑switching over to unicorn

【讨论】:

    【解决方案2】:

    您的 Gemfile 中可能缺少一个 gem。确保您的应用程序所需的一切都在 Gemfile 中指定,而不是在本地执行“gem install”。要验证,您可以安装RVM,专门为您的应用创建一个 gemset,在您的应用目录中运行“bundle install”,然后查看您的应用是否在本地运行。如果它不运行,则肯定缺少 gem。

    【讨论】:

      【解决方案3】:

      似乎 heroku 正在尝试在没有 Procfile 的情况下启动 Thin 来告诉它。如上所述,Gemfile 中未安装 Thin,因此出现错误。如上所述,将 Thin 从开发组中移除是可行的。

      如果您想让 heroku 启动 Unicorn 而不是 Thin,请设置您的 config/unicorn.rb 和 Procfile,如下所示:https://devcenter.heroku.com/articles/rails-unicorn

      Unicorn 的 Procfile 内容在上面的链接中列出,有关 Procfile(只是应用程序根目录中名为“Procfile”的文件)的更多信息:https://devcenter.heroku.com/articles/procfile

      【讨论】:

        猜你喜欢
        • 2023-03-18
        • 2018-01-21
        • 1970-01-01
        • 2011-04-24
        • 1970-01-01
        • 2022-06-14
        • 2014-06-10
        • 2015-07-08
        • 1970-01-01
        相关资源
        最近更新 更多