【问题标题】:"bundler: failed to load command: thin" on HerokuHeroku 上的“捆绑器:无法加载命令:瘦”
【发布时间】:2018-01-21 04:36:00
【问题描述】:

我正在使用 Ruby 2.2.7 和 Rails 3.2.21,并尝试在 Heroku 上部署一个 with gem: locomotive_cms of version: ~> 2.5.7,它已成功部署,但我面临以下错误:

2017-08-12T23:33:13.732440+00:00 app[web.1]:bundler:加载命令失败:thin (/app/vendor/bundle/ruby/2.2.0/bin/thin) 2017-08-12T23:33:13.732490+00:00 应用程序[web.1]:/app/vendor/bundle/ruby/2.2.0/gems/excon-0.23.0/lib/excon/middlewares/expects.rb :6:in `response_call'

这样,它也会产生这个:

Heroku::API::Errors::ErrorWithResponse: Expected(200) Actual(400 Bad Request)

我的 Gemfile 中有 thin,根据其文档,这是 locomotivecms 所必需的。

我也遇到过其他类似的问题,但我仍然无法解决我的问题。我有 Ruby 版本:2.2.7,虽然它说:/app/vendor/bundle/ruby/2.2.0/bin/thin

宝石文件:

source 'https://rubygems.org'
ruby "2.2.7"

gem 'rails', '3.2.21'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'locomotive_cms', '~> 2.5.7', :require => 'locomotive/engine'
gem 'dotenv-rails'

gem 'savon', '~> 2.3.0' # SOAP client for pulling in events
gem 'twitter', '5.8.0'
gem 'twitter-text'
gem 'whenever', require: false


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'compass-rails',  '~> 2.0.0'
  gem 'sass-rails',   '~> 3.2.4'
  gem 'coffee-rails', '~> 3.2.2'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '~> 1.2.4'
end

group :development do
  gem 'unicorn'
  gem 'pry'
end


# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

# To use on Heorku
gem 'locomotive-heroku', '~> 0.1.0', :require => 'locomotive/heroku'
gem 'thin'

Gemfile.lock:

你可以在这里找到它:https://gist.github.com/Arslan-Ali-Butt/640c1ec1750d17c9803e12a492f35c4e

【问题讨论】:

  • 仅供参考 - 如果您使用 rails 3.x.x 和 ruby​​ 2.2.x,您将遇到各种问题。使用支持 rails 4.x 的 CMS。
  • 您的 Gemfile 中还有什么? Gemfile.lock 中有什么?
  • @AaronBreckenridge 我已经用 Gemfile 更新了我的问题,并链接到 Gemfile.lock

标签: ruby-on-rails ruby heroku thin locomotivecms


【解决方案1】:

添加一个Procfile(将一个名为 Procfile 的文件放在应用的根目录中),告诉 Heroku 使用 Thin,如下所示:

web: bundle exec thin start -p $PORT

这将使您在 Heroku 上的生产中运行得更薄。我假设您的 Gemfile 配置正确

根据Heroku API guide,第二条消息指向一个错误的请求,但很难说它是如何与第一条错误消息联系起来的。

【讨论】:

  • Procfile 已经存在,内容为:web: bundle exec thin start -p $PORT -e $RACK_ENV
  • 您使用的是什么版本的 Thin?
  • 它是1.7.2。不过我没有在我的 Gemfile 中特别提到它。
  • 您是否查看了以下用户指南:locomotive-v3.readme.io/docs/heroku 在本指南中我没有看到应该将 think 添加到 gemfile 的位置(或者您可能使用的是旧版本的 Locomotive)
  • 我正在使用机车 CMS 版本:2.5.7,如问题中所述,您可以在此处找到其文档:doc.locomotivecms.com
【解决方案2】:

对于这个坏消息,我们深表歉意。

我查看了您的 Gemfile 和 Gemfile.lock,还查看了 PR https://github.com/locomotivecms/locomotive-heroku/pull/11 和 locomotive_cms 的最新 2.5.x 分支 https://github.com/locomotivecms/engine/tree/v2.5.x。由于您所依赖的 Gems 版本缺乏维护,您已达到功能的尽头。

locomotive_cms 已重命名为 locomotivecms 并升级到版本 3+。 locomotive_cms gem 不再维护。不仅如此,它还不再与您正在使用的许多其他依赖项兼容,即 excon。

Bundler could not find compatible versions for gem "excon":
  In Gemfile:
    locomotive_cms was resolved to 2.5.8, which depends on
      fog (~> 1.12.1) was resolved to 1.12.1, which depends on
        excon (~> 0.23.0)

    locomotive-heroku was resolved to 0.1.0, which depends on
      heroku-api (~> 0.3.23) was resolved to 0.3.23, which depends on
        excon (~> 0.44)

您将需要通过https://locomotive-v3.readme.io/docs/upgrade-to-v3 上的升级指南。

【讨论】:

  • 是的,我已经联系了Heorku团队,确实是这个原因。 locomotive_cms 与最新版本的 Heroku API 不兼容。
猜你喜欢
  • 2018-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-18
  • 1970-01-01
  • 2016-01-15
  • 2016-12-17
  • 2014-06-24
相关资源
最近更新 更多