简体   繁体   English

“bundler:command not found:thin”heroku部署rails

[英]“bundler: command not found: thin” heroku deployment rails

So my app runs perfectly on my local machine and I pushed it to github and heroku successfully but when I try opening the application in my browser, I get the following error: 所以我的应用程序在我的本地机器上运行完美,我成功地将它推送到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.

Then I try running 然后我尝试跑步

$ heroku logs

And I get the following output in my console: 我在控制台中获得以下输出:

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=

I can't figure what to make of this, since this is my first time deploying to heroku and I don't know anything about web-deployment. 我无法想象如何制作这个,因为这是我第一次部署到heroku而我对网络部署一无所知。 Any help would be greatly appreciated! 任何帮助将不胜感激!

For me the issue was that I added thin to my Gemfile in the development section, but once I did that heroku wanted to use it for production, but doesn't install the gems in the development section. 对我来说问题是我在开发部分为我的Gemfile添加了瘦,但是一旦我这样做,heroku就想用它进行生产,但是没有在开发部分安装gem。 By moving the thin gem out of the development section for use by all environments, I was able to get past this error. 通过将精灵宝石移出开发部分以供所有环境使用,我能够克服此错误。

Your Gemfile will probably look something like this for a Rails app: 对于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 for a production web server anyway. 无论如何,Heroku 建议使用瘦身作为生产网络服务器。

Update (2012-05-16): In that Rails 3 webserver link above Heroku now recommends unicorn . 更新(2012-05-16):在Heroku上面的Rails 3网络服务器链接现在推荐了独角兽 thin will still work, but you may want to consider switching over to unicorn . 瘦还可以,但你可能想考虑切换到独角兽

You're probably missing a gem in your Gemfile. 您可能错过了Gemfile中的gem。 Make sure that everything your application needs is specified in the Gemfile, as opposed to locally doing a "gem install ". 确保在Gemfile中指定了应用程序所需的所有内容,而不是在本地执行“gem install”。 To verify, you could install RVM , create a gemset specifically for your app, run "bundle install" in your app dir, and then see if your app runs locally. 要验证,您可以安装RVM ,专门为您的应用创建gemset,在您的应用目录中运行“bundle install”,然后查看您的应用是否在本地运行。 If it does not run, a gem is definitely missing. 如果它没有运行,肯定会丢失一个宝石。

It appears that heroku is trying to start Thin in the absence of a Procfile to tell it otherwise. 似乎heroku试图在没有Procfile的情况下启动Thin来告诉它。 As noted above, Thin is not installed in the Gemfile, hence the error. 如上所述,Thin未安装在Gemfile中,因此出错。 Taking Thin out of the development group will work, as noted above. 如上所述,从开发组中取出Thin将起作用。

If you want to get heroku to start Unicorn instead of Thin, set up your config/unicorn.rb and your Procfile as indicated here: https://devcenter.heroku.com/articles/rails-unicorn 如果你想让heroku启动Unicorn而不是Thin,请设置你的config / unicorn.rb和你的Procfile,如下所示: https ://devcenter.heroku.com/articles/rails-unicorn

The Procfile contents for Unicorn are listed in the link above, and more info about the Procfile (just a file called 'Procfile' in the root of your application) here: https://devcenter.heroku.com/articles/procfile Unicorn的Procfile内容列在上面的链接中,有关Procfile的更多信息(在应用程序的根目录中只是一个名为'Procfile'的文件): https ://devcenter.heroku.com/articles/procfile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM